diff --git a/docker/database/start-scripts/0-init.sql b/docker/database/start-scripts/0-init.sql index 0889690e..983015b3 100644 --- a/docker/database/start-scripts/0-init.sql +++ b/docker/database/start-scripts/0-init.sql @@ -63,7 +63,7 @@ create table pruning_types ( created_at timestamp default current_timestamp ); ---* Points and zones +--* Points, zones and routes create table points ( id int auto_increment primary key, latitude decimal(10, 7) not null, @@ -82,6 +82,15 @@ create table zones ( constraint UC_Zone unique (name, postal_code) ); +create table routes ( + id int auto_increment primary key, + distance float, + point_id int, + travel_time int, + created_at timestamp default current_timestamp, + foreign key (point_id) references points(id) +); + --* Elements and incidences create table elements ( id int auto_increment primary key, @@ -109,79 +118,76 @@ create table incidences ( foreign key (element_id) references elements(id) ); ---TODO: tasks, routes and works +--* Work orders, tasks and reports create table work_orders ( id int auto_increment primary key, - name varchar(255), + contract_id int, created_at timestamp default current_timestamp, updated_at timestamp, - deleted_at timestamp + deleted_at timestamp, + foreign key (contract_id) references contracts(id) ); -create table parts ( +create table tasks ( id int auto_increment primary key, - observation varchar(255), - quantity int, - fuel decimal, - picture varchar(255) + work_order_id int not null, + notes varchar(255), + created_at timestamp default current_timestamp, + deleted_at timestamp, + foreign key (work_order_id) references work_orders(id) ); -create table routes ( +create table tasks_workers ( id int auto_increment primary key, - distance float, - point_id int, - travel_time int, - created_at timestamp default current_timestamp, - foreign key (point_id) references points(id) + task_id int, + worker_id int, + foreign key (task_id) references tasks(id), + foreign key (worker_id) references workers(id) ); -create table tasks ( +create table tasks_zones ( id int auto_increment primary key, - task_name varchar(255), - work_order_id int, - description varchar(255), - element_id int, - machine_id int, - route_id int, - part_id int, - history_id int, + task_id int, + zone_id int, + foreign key (task_id) references tasks(id), + foreign key (zone_id) references zones(id) +); + +create table tasks_tasktypes ( + id int auto_increment primary key, + task_id int, + tasktype_id int, + foreign key (task_id) references tasks(id), + foreign key (tasktype_id) references task_types(id) +); + +create table work_reports ( + id int primary key, + observation varchar(255), + spent_fuel decimal, + photo varchar(255), created_at timestamp default current_timestamp, updated_at timestamp, - deleted_at timestamp, - foreign key (work_order_id) references work_orders(id), - foreign key (element_id) references elements(id), - foreign key (machine_id) references machines(id), - foreign key (route_id) references routes(id), - foreign key (part_id) references parts(id) + foreign key (id) references work_orders(id) ); -create table task_workers ( +--* Sensors and sensor history +create table sensors ( id int auto_increment primary key, - task_id int, - worker_id int, + zone_id int not null, + model varchar(255), + class varchar(255), + is_active boolean, created_at timestamp default current_timestamp, - foreign key (task_id) references tasks(id), - foreign key (worker_id) references workers(id) + foreign key (zone_id) references zones(id) ); ---* FUTURE: sensors and sensor history --- create table sensors ( --- id int auto_increment primary key, --- entidad_vegetal int, --- element_id int, --- model varchar(255), --- operative boolean, --- class varchar(255), --- created_at timestamp default current_timestamp, --- foreign key (element_id) references elements(id) --- ); --- --- create table sensor_history ( --- id int auto_increment primary key, --- sensor_id int, --- temperature float, --- humedad float, --- inclination float, --- created_at timestamp default current_timestamp, --- foreign key (sensor_id) references sensors(id) --- ); +create table sensor_history ( + id int auto_increment primary key, + sensor_id int not null, + temperature float, + humidity float, + inclination float, + created_at timestamp default current_timestamp, + foreign key (sensor_id) references sensors(id) +); diff --git a/docker/database/start-scripts/1-seed.sql b/docker/database/start-scripts/1-seed.sql index 30a4e040..d18efacf 100644 --- a/docker/database/start-scripts/1-seed.sql +++ b/docker/database/start-scripts/1-seed.sql @@ -1,58 +1,47 @@ --- Insert sample roles (Admin, Manager, Worker) +--* Roles, users, contracts and machines INSERT INTO roles (name) VALUES ('Administrador'), ('Gerente'), ('Trabajador'); - --- Insert sample workers (Spanish users) INSERT INTO workers (company, name, dni, password, email, role_id, created_at, updated_at, deleted_at) VALUES -('TechCorp', 'Carlos García', '12345678A', 'hashedpassword1', 'carlos.garcia@example.com', 1, NOW(), NOW(), NULL), -- Admin -('InnovaTech', 'Ana Martínez', '23456789B', 'hashedpassword2', 'ana.martinez@example.com', 2, NOW(), NOW(), NULL), -- Manager -('DesignWorks', 'José Rodríguez', '34567890C', 'hashedpassword3', 'jose.rodriguez@example.com', 3, NOW(), NOW(), NULL); -- Worker - --- Insert sample tree types -INSERT INTO tree_types (family, genus, species) VALUES -('Fagaceae', 'Quercus', 'Quercus robur'), -('Pinaceae', 'Pinus', 'Pinus sylvestris'), -('Sapindaceae', 'Acer', 'Acer campestre'); - --- Insert sample contracts +('TechCorp', 'Carlos García', '12345678A', 'hashedpassword1', 'carlos.garcia@example.com', 1, NOW(), NOW(), NULL), +('InnovaTech', 'Ana Martínez', '23456789B', 'hashedpassword2', 'ana.martinez@example.com', 2, NOW(), NOW(), NULL), +('DesignWorks', 'José Rodríguez', '34567890C', 'hashedpassword3', 'jose.rodriguez@example.com', 3, NOW(), NOW(), NULL); INSERT INTO contracts (name, start_date, end_date, invoice_proposed, invoice_agreed, invoice_paid) VALUES ('Ayuntamiento de Valencia', '2021-01-01', '2021-12-31', 1000.00, 900.00, 900.00), ('Administración General del Estado', '2021-01-01', '2021-12-31', 2000.00, 1800.00, 1800.00), ('Ayuntamiento de Carlet', '2021-01-01', '2021-12-31', 3000.00, 2700.00, 2700.00); - --- Insert sample task types +INSERT INTO machines (name, max_basket_size) VALUES +('Cesta elevadora', 200.00), +('Plataforma elevadora', 300.00), +('Tijera elevadora', 400.00); +--* Tree, task and pruning types +INSERT INTO tree_types (family, genus, species) VALUES +('Fagaceae', 'Quercus', 'Quercus robur'), +('Pinaceae', 'Pinus', 'Pinus sylvestris'), +('Sapindaceae', 'Acer', 'Acer campestre'); INSERT INTO task_types (name) VALUES ('Abono arbustos'), ('Podar setos'), ('Abono setos'); - --- Insert sample pruning types INSERT INTO pruning_types (name, description) VALUES ('A', 'Poda de mantenimiento en árbol tipo A, caduco, de p.c. entre 41/80 cm.'), ('B', 'Poda de mantenimiento en árbol tipo B, caduco, de p.c. mayor de 81 cm.'), ('C', 'Poda de mantenimiento en árbol tipo C, perenne, de p.c. entre 41/60 cm.'); - --- Insert sample points +--* Points and zones INSERT INTO points (latitude, longitude) VALUES (40.416775, -3.703790), (40.416776, -3.703795), (40.416777, -3.703800); - --- Insert sample zones INSERT INTO zones (name, postal_code, point_id) VALUES ('Zona 1', '46001', 1), ('Zona 2', '46002', 2), ('Zona 3', '46003', 3); - --- Insert sample elements +--* Elements and incidences INSERT INTO elements (name, zone_id, point_id, tree_type_id) VALUES ('Árbol 1', 1, 1, 1), ('Árbol 2', 2, 2, 2), ('Árbol 3', 3, 3, 3); - --- Insert sample incidences INSERT INTO incidences (name, element_id, description) VALUES ('Rama caída', 1, 'Rama caída en el suelo'), ('Banco roto', 2, 'Banco roto en el parque'), @@ -60,3 +49,28 @@ INSERT INTO incidences (name, element_id, description) VALUES ('Árbol enfermo', 1, 'Árbol con signos de enfermedad'), ('Banco pintado', 2, 'Banco pintado con grafitis'), ('Fuente con fuga', 3, 'Fuente con fuga de agua'); +--TODO: tasks, routes and works +INSERT INTO work_orders (contract_id) VALUES +(1), +(2), +(3); + +INSERT INTO tasks (work_order_id, notes) VALUES +(1, 'Poda de mantenimiento en árbol tipo A, caduco, de p.c. entre 41/80 cm.'), +(2, 'Poda de mantenimiento en árbol tipo B, caduco, de p.c. entre 50/100 cm.'), +(3, 'Poda de mantenimiento en árbol tipo C, caduco, de p.c. entre 60/120 cm.'); + +INSERT INTO tasks_zones (task_id, zone_id) VALUES +(1, 1), +(2, 2), +(3, 3); + +INSERT INTO tasks_tasktypes (task_id, tasktype_id) VALUES +(1, 1), +(2, 2), +(3, 3); + +INSERT INTO tasks_workers (task_id, worker_id) VALUES +(1, 1), +(2, 2), +(3, 3); diff --git a/src/app/Controllers/CWorkOrder.php b/src/app/Controllers/CWorkOrder.php new file mode 100644 index 00000000..6bf06e08 --- /dev/null +++ b/src/app/Controllers/CWorkOrder.php @@ -0,0 +1,60 @@ + "order/index", + "title" => "Order", + "layout" => "MainLayout", + "data" => ["orders" => $orders] + ]); + } + + public function find() + { + $id = $_GET['id']; + $order = MWorkOrder::find($id); + View::render([ + "view" => "order", + "title" => "Order", + "layout" => "MainLayout", + "data" => ["order" => $order] + ]); + } + + public function indexCreate() + { + $orders = MWorkOrder::findAll(); + View::render([ + "view" => "order/create", + "title" => "Create Order", + "layout" => "MainLayout", + "data" => ["orders" => $orders] + ]); + } + + public function save() + { + $order = new MWorkOrder(); + + $order->save(); + } + + public function delete() + { + $id = $_GET['id']; + $order = MWorkOrder::find($id); + $order->delete(); + } + + public function update() + { + + } +} \ No newline at end of file diff --git a/src/app/Core/BaseModel.php b/src/app/Models/BaseModel.php similarity index 81% rename from src/app/Core/BaseModel.php rename to src/app/Models/BaseModel.php index 4deff38c..62cd51b0 100644 --- a/src/app/Core/BaseModel.php +++ b/src/app/Models/BaseModel.php @@ -1,13 +1,17 @@ {$ownerKey}; + + $query = " + SELECT $relatedTable.* + FROM $relatedTable + INNER JOIN $pivotTable ON $pivotTable.$relatedKey = $relatedTable.$relatedOwnerKey + WHERE $pivotTable.$foreignKey = :localKeyValue + "; + + $results = Database::prepareAndExecute($query, ['localKeyValue' => $localKeyValue]); + + return array_map(fn($row) => $relatedModel::mapDataToModel($row), $results); + } + + public function delete(): void { $table = static::getTableName(); @@ -90,7 +113,7 @@ public function hasMany($relatedModel, $foreignKey, $localKey = 'id') } // Dynamically check if a table has the deleted_at column - protected static function hasSoftDelete() + protected static function hasSoftDelete(): bool { static $softDeleteCache = []; $table = static::getTableName(); @@ -104,7 +127,7 @@ protected static function hasSoftDelete() return $softDeleteCache[$table]; } - public function restore() + public function restore(): void { if (static::hasSoftDelete()) { $table = static::getTableName(); @@ -113,7 +136,7 @@ public function restore() } } - public function save() + public function save(): void { $table = static::getTableName(); $properties = get_object_vars($this); @@ -145,12 +168,12 @@ abstract protected static function getTableName(); abstract protected static function mapDataToModel($data); //* Getters and Setters - public function getId() + public function getId(): int { return $this->id; } - public function getCreatedAt() + public function getCreatedAt(): string { return $this->created_at; } diff --git a/src/app/Models/MContract.php b/src/app/Models/MContract.php index b35e3f58..47145a0c 100644 --- a/src/app/Models/MContract.php +++ b/src/app/Models/MContract.php @@ -2,25 +2,23 @@ namespace App\Models; -use App\Core\BaseModel; - class MContract extends BaseModel { - public $name; - public $start_date; - public $end_date; - public $invoice_proposed; - public $invoice_agreed; - public $invoice_paid; + public string $name; + public string $start_date; + public ?string $end_date; + public ?float $invoice_proposed; + public ?float $invoice_agreed; + public ?float $invoice_paid; - protected static function getTableName() + protected static function getTableName(): string { return 'contracts'; } - protected static function mapDataToModel($data) + protected static function mapDataToModel($data): MContract { - $contract = new MContract(); + $contract = new self(); $contract->id = $data['id']; $contract->name = $data['name']; $contract->start_date = $data['start_date']; diff --git a/src/app/Models/MElement.php b/src/app/Models/MElement.php index b51dfbfc..6a698168 100644 --- a/src/app/Models/MElement.php +++ b/src/app/Models/MElement.php @@ -2,8 +2,6 @@ namespace App\Models; -use App\Core\BaseModel; - class MElement extends BaseModel { public string $name; @@ -11,14 +9,14 @@ class MElement extends BaseModel public int $point_id; public int $tree_type_id; - protected static function getTableName() + protected static function getTableName(): string { return 'elements'; } - protected static function mapDataToModel($data) + protected static function mapDataToModel($data): MElement { - $element = new MElement(); + $element = new self(); $element->id = $data['id']; $element->name = $data['name']; $element->zone_id = $data['zone_id']; @@ -28,23 +26,18 @@ protected static function mapDataToModel($data) return $element; } - public function zone() + public function zone(): MZone { return $this->belongsTo(MZone::class, 'zone_id'); } - public function point() + public function point(): MPoint { return $this->belongsTo(MPoint::class, 'point_id'); } - public function treeType() + public function treeType(): MTreeType { return $this->belongsTo(MTreeType::class, 'tree_type_id'); } - - public function getCreatedAt() - { - return $this->created_at; - } } diff --git a/src/app/Models/MIncidence.php b/src/app/Models/MIncidence.php index d2dab76c..ef0ea729 100644 --- a/src/app/Models/MIncidence.php +++ b/src/app/Models/MIncidence.php @@ -2,23 +2,21 @@ namespace App\Models; -use App\Core\BaseModel; - class MIncidence extends BaseModel { public int $element_id; public string $name; - public string $description; + public ?string $description; public ?string $photo; - protected static function getTableName() + protected static function getTableName(): string { return 'incidences'; } - public static function mapDataToModel($data) + public static function mapDataToModel($data): MIncidence { - $incidence = new MIncidence(); + $incidence = new self(); $incidence->id = $data['id']; $incidence->element_id = $data['element_id']; $incidence->name = $data['name']; @@ -29,13 +27,8 @@ public static function mapDataToModel($data) } // Fetch the element of the incidence - public function element() + public function element(): MElement { return $this->belongsTo(MElement::class, 'element_id'); } - - public function getCreatedAt() - { - return $this->created_at; - } } diff --git a/src/app/Models/MMachine.php b/src/app/Models/MMachine.php new file mode 100644 index 00000000..9e3c6673 --- /dev/null +++ b/src/app/Models/MMachine.php @@ -0,0 +1,24 @@ +id = $data['id']; + $machine->name = $data['name']; + $machine->max_basket_size = $data['max_basket_size']; + $machine->created_at = $data['created_at']; + return $machine; + } +} diff --git a/src/app/Models/MPoint.php b/src/app/Models/MPoint.php index c52bb0ad..c4cd7a84 100644 --- a/src/app/Models/MPoint.php +++ b/src/app/Models/MPoint.php @@ -2,21 +2,19 @@ namespace App\Models; -use App\Core\BaseModel; - class MPoint extends BaseModel { public $latitude; public $longitude; - protected static function getTableName() + protected static function getTableName(): string { return 'points'; } - protected static function mapDataToModel($data) + protected static function mapDataToModel($data): MPoint { - $point = new MPoint(); + $point = new self(); $point->id = $data['id']; $point->latitude = $data['latitude']; $point->longitude = $data['longitude']; diff --git a/src/app/Models/MPruningType.php b/src/app/Models/MPruningType.php index 74e0c254..51752c1b 100644 --- a/src/app/Models/MPruningType.php +++ b/src/app/Models/MPruningType.php @@ -2,21 +2,19 @@ namespace App\Models; -use App\Core\BaseModel; - class MPruningType extends BaseModel { public string $name; public ?string $description; - protected static function getTableName() + protected static function getTableName(): string { return 'pruning_types'; } - protected static function mapDataToModel($data) + protected static function mapDataToModel($data): MPruningType { - $pruning_type = new MPruningType(); + $pruning_type = new self(); $pruning_type->id = $data['id']; $pruning_type->name = $data['name']; $pruning_type->description = $data['description']; diff --git a/src/app/Models/MRole.php b/src/app/Models/MRole.php index 3e73d382..6d3592bf 100644 --- a/src/app/Models/MRole.php +++ b/src/app/Models/MRole.php @@ -2,20 +2,18 @@ namespace App\Models; -use App\Core\BaseModel; - class MRole extends BaseModel { - public $name; + public string $name; - protected static function getTableName() + protected static function getTableName(): string { return 'roles'; } - protected static function mapDataToModel($data) + protected static function mapDataToModel($data): MRole { - $role = new MRole(); + $role = new self(); $role->id = $data['id']; $role->name = $data['name']; $role->created_at = $data['created_at']; diff --git a/src/app/Models/MRoute.php b/src/app/Models/MRoute.php new file mode 100644 index 00000000..7acbce2e --- /dev/null +++ b/src/app/Models/MRoute.php @@ -0,0 +1,31 @@ +id = $data['id']; + $role->distance = $data['distance']; + $role->point_id = $data['point_id']; + $role->travel_time = $data['travel_time']; + $role->created_at = $data['created_at']; + return $role; + } + + public function point(): MPoint + { + return $this->belongsTo(MPoint::class, 'point_id'); + } +} diff --git a/src/app/Models/MSensor.php b/src/app/Models/MSensor.php new file mode 100644 index 00000000..767b93cd --- /dev/null +++ b/src/app/Models/MSensor.php @@ -0,0 +1,32 @@ +zone_id = $data["zone_id"]; + $sensor->model = $data["model"]; + $sensor->class = $data["class"]; + $sensor->is_active = $data["is_active"]; + $sensor->created_at = $data["created_at"]; + return $sensor; + } + + public function zone(): MZone + { + return $this->belongsTo(MZone::class, "zone_id", "id"); + } +} diff --git a/src/app/Models/MSensorHistory.php b/src/app/Models/MSensorHistory.php new file mode 100644 index 00000000..b469efa5 --- /dev/null +++ b/src/app/Models/MSensorHistory.php @@ -0,0 +1,32 @@ +sensor_id = $data['sensor_id']; + $sensor_history->temperature = $data['temperature']; + $sensor_history->humidity = $data['humidity']; + $sensor_history->inclination = $data['inclination']; + $sensor_history->created_at = $data['created_at']; + return $sensor_history; + } + + public function sensor(): MSensor + { + return $this->belongsTo(MSensor::class, 'sensor_id'); + } +} diff --git a/src/app/Models/MTask.php b/src/app/Models/MTask.php new file mode 100644 index 00000000..62112c97 --- /dev/null +++ b/src/app/Models/MTask.php @@ -0,0 +1,46 @@ +id = $data['id']; + $task->notes = $data['notes']; + $task->work_order_id = $data['work_order_id']; + $task->created_at = $data['created_at']; + return $task; + } + + public function order(): MWorkOrder + { + return $this->belongsTo(MWorkOrder::class, 'work_order_id', 'id'); + } + + public function zones() + { + return $this->belongsToMany(MZone::class, 'tasks_zones', 'task_id', 'zone_id'); + } + + public function workers() + { + return $this->belongsToMany(MWorker::class, 'tasks_workers', 'task_id', 'worker_id'); + } + + public function taskTypes() + { + return $this->belongsToMany(MTaskType::class, 'tasks_tasktypes', 'task_id', 'tasktype_id'); + } +} diff --git a/src/app/Models/MTaskType.php b/src/app/Models/MTaskType.php index 7a1f8163..f85586d4 100644 --- a/src/app/Models/MTaskType.php +++ b/src/app/Models/MTaskType.php @@ -2,20 +2,18 @@ namespace App\Models; -use App\Core\BaseModel; - class MTaskType extends BaseModel { public string $name; - protected static function getTableName() + protected static function getTableName(): string { return 'task_types'; } - protected static function mapDataToModel($data) + protected static function mapDataToModel($data): MTaskType { - $task = new MTaskType(); + $task = new self(); $task->id = $data['id']; $task->name = $data['name']; $task->created_at = $data['created_at']; diff --git a/src/app/Models/MTreeType.php b/src/app/Models/MTreeType.php index 823ef0f2..ea81aa43 100644 --- a/src/app/Models/MTreeType.php +++ b/src/app/Models/MTreeType.php @@ -2,22 +2,20 @@ namespace App\Models; -use App\Core\BaseModel; - class MTreeType extends BaseModel { public string $family; public string $genus; public string $species; - protected static function getTableName() + protected static function getTableName(): string { return 'tree_types'; } - protected static function mapDataToModel($data) + protected static function mapDataToModel($data): MTreeType { - $tree_type = new MTreeType(); + $tree_type = new self(); $tree_type->id = $data['id']; $tree_type->family = $data['family']; $tree_type->genus = $data['genus']; diff --git a/src/app/Models/MWorkOrder.php b/src/app/Models/MWorkOrder.php new file mode 100644 index 00000000..dd27e245 --- /dev/null +++ b/src/app/Models/MWorkOrder.php @@ -0,0 +1,37 @@ +id = $data['id']; + $order->contract_id = $data['contract_id']; + $order->created_at = $data['created_at']; + return $order; + } + + public function report(): MWorkReport + { + return $this->hasMany(MWorkReport::class, 'id')[0]; + } + + public function contract(): MContract + { + return $this->belongsTo(MContract::class, 'contract_id', 'id'); + } + + public function tasks() + { + return $this->hasMany(MTask::class, 'work_order_id', 'id'); + } +} diff --git a/src/app/Models/MWorkReport.php b/src/app/Models/MWorkReport.php new file mode 100644 index 00000000..49085bf2 --- /dev/null +++ b/src/app/Models/MWorkReport.php @@ -0,0 +1,31 @@ +id = $data['id']; + $workReport->observation = $data['observation']; + $workReport->spent_fuel = $data['spent_fuel']; + $workReport->photo = $data['photo']; + $workReport->created_at = $data['created_at']; + return $workReport; + } + + public function workOrder(): MWorkOrder + { + return $this->belongsTo(MWorkOrder::class, 'id'); + } +} diff --git a/src/app/Models/MWorker.php b/src/app/Models/MWorker.php index 80f5d148..75aefb6e 100644 --- a/src/app/Models/MWorker.php +++ b/src/app/Models/MWorker.php @@ -2,26 +2,24 @@ namespace App\Models; -use App\Core\BaseModel; - class MWorker extends BaseModel { - public string $company; - public string $name; + public ?string $company; + public ?string $name; public string $dni; - public string $password; - public string $email; - public int $role_id; + public ?string $password; + public ?string $email; + public ?int $role_id; - protected static function getTableName() + protected static function getTableName(): string { return 'workers'; } - protected static function mapDataToModel($data) + protected static function mapDataToModel($data): MWorker { - $user = new MWorker(); + $user = new self(); $user->id = $data['id']; $user->company = $data['company']; $user->name = $data['name']; @@ -33,8 +31,7 @@ protected static function mapDataToModel($data) return $user; } - // Fetch the user's role - public function role() + public function role(): MRole { return $this->belongsTo(MRole::class, 'role_id'); } diff --git a/src/app/Models/MZone.php b/src/app/Models/MZone.php index cf2d2822..31f76af6 100644 --- a/src/app/Models/MZone.php +++ b/src/app/Models/MZone.php @@ -2,22 +2,20 @@ namespace App\Models; -use App\Core\BaseModel; - class MZone extends BaseModel { - public $name; - public $postal_code; - public $point_id; + public string $name; + public int $postal_code; + public int $point_id; - protected static function getTableName() + protected static function getTableName(): string { return 'zones'; } - protected static function mapDataToModel($data) + protected static function mapDataToModel($data): MZone { - $zone = new MZone(); + $zone = new self(); $zone->id = $data['id']; $zone->name = $data['name']; $zone->postal_code = $data['postal_code']; @@ -26,8 +24,7 @@ protected static function mapDataToModel($data) return $zone; } - // Fetch the zone's point - public function point() + public function point(): MPoint { return $this->belongsTo(MPoint::class, 'point_id'); } diff --git a/src/app/Views/order/create.php b/src/app/Views/order/create.php new file mode 100644 index 00000000..970605b5 --- /dev/null +++ b/src/app/Views/order/create.php @@ -0,0 +1,31 @@ + + + + + + Crear Ordres + + +

Crear Ordre de Treball

+ +
+ + + + + + + + + + +
+ + \ No newline at end of file diff --git a/src/app/Views/order/index.php b/src/app/Views/order/index.php new file mode 100644 index 00000000..ab28424c --- /dev/null +++ b/src/app/Views/order/index.php @@ -0,0 +1,73 @@ + + + + + + + Llista d'Ordres + + + +

Ordre de Treball

+ + + + + + + + + + + + + + + + + + tasks() as $task): ?> + + + + + + + + + + + + + +
ContracteDataZonesTasquesOperarisNotesEstatOpcions
contract()->name; ?>getCreatedAt(); ?> + zones() as $zone): ?> + name; ?>, + + + taskTypes() as $task_type): ?> + name; ?>, + + + workers() as $worker): ?> + name; ?>, + + notes; ?> + + +
+ +
+
+ + + \ No newline at end of file diff --git a/src/storage/images/.gitignore b/src/storage/images/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/src/storage/images/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/src/storage/images/demo.png b/src/storage/images/demo.png deleted file mode 100644 index 1c23d27d..00000000 Binary files a/src/storage/images/demo.png and /dev/null differ diff --git a/src/storage/logs/.gitignore b/src/storage/logs/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/src/storage/logs/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/src/storage/logs/app.log b/src/storage/logs/app.log new file mode 100644 index 00000000..e69de29b