[#278] Plan du site #33
@@ -4,7 +4,7 @@
|
|||||||
<div class="flex flex-wrap justify-center pb-16 gap-12">
|
<div class="flex flex-wrap justify-center pb-16 gap-12">
|
||||||
<card-link label="NOUVELLE RÉCEPTION" link="/reception" iconName="mdi:truck-outline" />
|
<card-link label="NOUVELLE RÉCEPTION" link="/reception" iconName="mdi:truck-outline" />
|
||||||
<card-link label="NOUVELLE EXPÉDITION" link="/shipment" iconName="mdi:truck-fast-outline" />
|
<card-link label="NOUVELLE EXPÉDITION" link="/shipment" iconName="mdi:truck-fast-outline" />
|
||||||
<card-link label="PLAN DE SITE" link="/" iconName="material-symbols:warehouse-outline-rounded" />
|
<card-link label="PLAN DE SITE" link="/infrastructure/batiment" iconName="material-symbols:warehouse-outline-rounded" />
|
||||||
<card-link link="/reception/waiting-reception" iconName="mdi:truck-remove-outline">
|
<card-link link="/reception/waiting-reception" iconName="mdi:truck-remove-outline">
|
||||||
<template #label>
|
<template #label>
|
||||||
Réceptions<br>EN ATTENTE
|
Réceptions<br>EN ATTENTE
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
EXPÉDITIONS<br>EN ATTENTE
|
EXPÉDITIONS<br>EN ATTENTE
|
||||||
</template>
|
</template>
|
||||||
</card-link>
|
</card-link>
|
||||||
<card-link label="CASES" link="/" iconName="material-symbols:bottom-sheets-outline" />
|
<card-link label="CASES" link="/infrastructure/case" iconName="material-symbols:bottom-sheets-outline" />
|
||||||
<card-link label="RÉCEPTIONS FINIES" link="/reception/finish-reception" iconName="mdi:truck-check-outline" />
|
<card-link label="RÉCEPTIONS FINIES" link="/reception/finish-reception" iconName="mdi:truck-check-outline" />
|
||||||
<card-link label="EXPÉDITIONS FINIES" link="/shipment/finish-shipment" iconName="mdi:truck-delivery-outline" />
|
<card-link label="EXPÉDITIONS FINIES" link="/shipment/finish-shipment" iconName="mdi:truck-delivery-outline" />
|
||||||
<card-link link="/" iconName="mdi:cow">
|
<card-link link="/" iconName="mdi:cow">
|
||||||
|
|||||||
199
frontend/pages/infrastructure/batiment.vue
Normal file
199
frontend/pages/infrastructure/batiment.vue
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
<template>
|
||||||
|
<div class="min-h-screen">
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div class="flex items-center gap-10">
|
||||||
|
<Icon
|
||||||
|
@click="router.push('/')"
|
||||||
|
name="gg:arrow-left-o"
|
||||||
|
size="44"
|
||||||
|
class="cursor-pointer text-primary-500"
|
||||||
|
/>
|
||||||
|
<h1 class="text-3xl font-bold uppercase text-primary-500">bâtiments</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="px-[86px]">
|
||||||
|
<div class="mt-6 border border-slate-200 mb-16">
|
||||||
|
<div
|
||||||
|
v-for="entry in buildingLayouts"
|
||||||
|
:key="entry.building.id"
|
||||||
|
class="border-t border-slate-200 first:border-t-0"
|
||||||
|
>
|
||||||
|
<div class="bg-slate-100 px-4 py-3 font-semibold tracking-wide">
|
||||||
|
{{ entry.building.label || `Bâtiment ${entry.building.id}` }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="px-4 py-4">
|
||||||
|
<div v-if="!entry.layout" class="text-sm text-slate-400">
|
||||||
|
Aucun plan de bâtiment.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else>
|
||||||
|
<div class="overflow-auto">
|
||||||
|
<div
|
||||||
|
class="grid"
|
||||||
|
:style="getGridStyle(entry.layout, entry.columnsTemplate)"
|
||||||
|
>
|
||||||
|
<template v-for="cell in entry.cells" :key="cell.key">
|
||||||
|
<div
|
||||||
|
v-if="cell.isEmpty"
|
||||||
|
class="w-[26px] h-[50px]"
|
||||||
|
:style="getCellSpanStyle(cell)"
|
||||||
|
></div>
|
||||||
|
<NuxtLink
|
||||||
|
v-else
|
||||||
|
class="flex items-center justify-center border border-slate-200 border-y-black hover:bg-primary-500/15 h-[50px]"
|
||||||
|
:style="getCellSpanStyle(cell)"
|
||||||
|
:to="cell.caseId ? `/infrastructure/case?id=${cell.caseId}` : '/infrastructure/case'"
|
||||||
|
>
|
||||||
|
{{ cell.display }}
|
||||||
|
</NuxtLink>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { BuildingData } from "~/services/dto/building-data"
|
||||||
|
import type { BuildingLayoutData } from "~/services/dto/building-layout-data"
|
||||||
|
import type { BuildingCasePositionData } from "~/services/dto/building-case-position-data"
|
||||||
|
import { getBuildingList } from "~/services/building"
|
||||||
|
|
||||||
|
definePageMeta({ layout: "default" })
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const buildingList = ref<BuildingData[]>([])
|
||||||
|
const buildingLayouts = computed(() => {
|
||||||
|
return buildingList.value.map((building) => {
|
||||||
|
const layout = getDisplayLayout(building)
|
||||||
|
const view = layout ? buildLayoutView(layout) : null
|
||||||
|
return {
|
||||||
|
building,
|
||||||
|
layout,
|
||||||
|
cells: view?.cells ?? [],
|
||||||
|
columnsTemplate: view?.columnsTemplate
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
type LayoutCell = {
|
||||||
|
key: string
|
||||||
|
x: number
|
||||||
|
y: number
|
||||||
|
w: number
|
||||||
|
h: number
|
||||||
|
isEmpty: boolean
|
||||||
|
caseNumber: number | null
|
||||||
|
caseId: number | null
|
||||||
|
display: string
|
||||||
|
rawId?: number | string
|
||||||
|
}
|
||||||
|
const getDisplayLayout = (building: BuildingData): BuildingLayoutData | null => {
|
||||||
|
const layouts = (building.layouts ?? []).filter(Boolean) as BuildingLayoutData[]
|
||||||
|
if (layouts.length === 0) return null
|
||||||
|
return layouts[0] ?? null
|
||||||
|
}
|
||||||
|
const getGridStyle = (layout: BuildingLayoutData, columnsTemplate?: string) => {
|
||||||
|
const cols = Math.max(0, layout.columns ?? 0)
|
||||||
|
return {
|
||||||
|
gridTemplateColumns: columnsTemplate ?? `repeat(${cols}, minmax(0, 1fr))`,
|
||||||
|
gridAutoRows: "1fr",
|
||||||
|
rowGap: "18.5px",
|
||||||
|
columnGap: "0px",
|
||||||
|
width: "100%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const getCellSpanStyle = (cell: LayoutCell) => ({
|
||||||
|
gridColumn: `${cell.x} / span ${cell.w}`,
|
||||||
|
gridRow: `${cell.y} / span ${cell.h}`
|
||||||
|
})
|
||||||
|
const buildLayoutView = (
|
||||||
|
layout: BuildingLayoutData
|
||||||
|
): { cells: LayoutCell[]; columnsTemplate: string } | null => {
|
||||||
|
const totalRows = layout.rows ?? 0
|
||||||
|
const totalCols = layout.columns ?? 0
|
||||||
|
if (totalRows <= 0 || totalCols <= 0) return null
|
||||||
|
const positions = (layout.casePositions ?? []).filter(Boolean) as BuildingCasePositionData[]
|
||||||
|
|
||||||
|
// marque les cases couvertes par un span pour ne pas générer du "vide" dessus
|
||||||
|
const covered = Array.from({ length: totalRows }, () => Array.from({ length: totalCols }, () => false))
|
||||||
|
|
||||||
|
// map positions by (x,y)
|
||||||
|
const map = new Map<string, BuildingCasePositionData>()
|
||||||
|
const occupiedColumns = new Set<number>()
|
||||||
|
|
||||||
|
for (const p of positions) {
|
||||||
|
const rawX = p.x ?? 1
|
||||||
|
const rawY = p.y ?? 1
|
||||||
|
const key = `${rawX}-${rawY}`
|
||||||
|
if (!map.has(key)) map.set(key, p)
|
||||||
|
occupiedColumns.add(rawX)
|
||||||
|
}
|
||||||
|
const cells: LayoutCell[] = []
|
||||||
|
const gapColumns: number[] = []
|
||||||
|
for (let x = 1; x <= totalCols; x++) {
|
||||||
|
if (!occupiedColumns.has(x)) gapColumns.push(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let y = 1; y <= totalRows; y++) {
|
||||||
|
for (let x = 1; x <= totalCols; x++) {
|
||||||
|
if (covered[y - 1][x - 1]) continue
|
||||||
|
const p = map.get(`${x}-${y}`)
|
||||||
|
if (!p) continue
|
||||||
|
const w = p.w ?? 1
|
||||||
|
const h = p.h ?? 1
|
||||||
|
for (let dy = 0; dy < h; dy++) {
|
||||||
|
for (let dx = 0; dx < w; dx++) {
|
||||||
|
const ty = y - 1 + dy
|
||||||
|
const tx = x - 1 + dx
|
||||||
|
if (ty < totalRows && tx < totalCols) covered[ty][tx] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const caseNumber = (p.buildingCase?.caseNumber ?? null) as number | null
|
||||||
|
const caseId = (p.buildingCase?.id ?? null) as number | null
|
||||||
|
cells.push({
|
||||||
|
key: `case-${layout.id}-${p.id}`,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
w,
|
||||||
|
h,
|
||||||
|
isEmpty: false,
|
||||||
|
caseNumber,
|
||||||
|
caseId,
|
||||||
|
display: caseNumber !== null ? String(caseNumber) : "Case",
|
||||||
|
rawId: p.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const gapX of gapColumns) {
|
||||||
|
cells.push({
|
||||||
|
key: `gap-${layout.id}-${y}-${gapX}`,
|
||||||
|
x: gapX,
|
||||||
|
y,
|
||||||
|
w: 1,
|
||||||
|
h: 1,
|
||||||
|
isEmpty: true,
|
||||||
|
caseNumber: null,
|
||||||
|
caseId: null,
|
||||||
|
display: "",
|
||||||
|
rawId: undefined
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const columnsTemplate = Array.from({ length: totalCols }, (_, idx) =>
|
||||||
|
gapColumns.includes(idx + 1) ? "24px" : "minmax(0, 1fr)"
|
||||||
|
).join(" ")
|
||||||
|
|
||||||
|
return { cells, columnsTemplate }
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
buildingList.value = await getBuildingList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
6
frontend/pages/infrastructure/case.vue
Normal file
6
frontend/pages/infrastructure/case.vue
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
</script>
|
||||||
6
frontend/services/dto/building-case-data.ts
Normal file
6
frontend/services/dto/building-case-data.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export interface BuildingCaseData {
|
||||||
|
id: number
|
||||||
|
caseNumber: number | null
|
||||||
|
code: string | null
|
||||||
|
capacity: number | null
|
||||||
|
}
|
||||||
11
frontend/services/dto/building-case-position-data.ts
Normal file
11
frontend/services/dto/building-case-position-data.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import type { BuildingCaseData } from '~/services/dto/building-case-data'
|
||||||
|
|
||||||
|
export interface BuildingCasePositionData {
|
||||||
|
id: number
|
||||||
|
x: number | null
|
||||||
|
y: number | null
|
||||||
|
w: number | null
|
||||||
|
h: number | null
|
||||||
|
renderOrder: string | null
|
||||||
|
buildingCase: BuildingCaseData | null
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
|
import type { BuildingLayoutData } from '~/services/dto/building-layout-data'
|
||||||
|
|
||||||
export interface BuildingData {
|
export interface BuildingData {
|
||||||
id: number
|
id: number
|
||||||
label: string
|
label: string
|
||||||
code: string
|
code: string
|
||||||
|
layouts?: BuildingLayoutData[] | null
|
||||||
}
|
}
|
||||||
|
|||||||
9
frontend/services/dto/building-layout-data.ts
Normal file
9
frontend/services/dto/building-layout-data.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import type { BuildingCasePositionData } from '~/services/dto/building-case-position-data'
|
||||||
|
|
||||||
|
export interface BuildingLayoutData {
|
||||||
|
id: number
|
||||||
|
name: string | null
|
||||||
|
columns: number | null
|
||||||
|
rows: number | null
|
||||||
|
casePositions?: BuildingCasePositionData[] | null
|
||||||
|
}
|
||||||
47
migrations/Version20260219100826.php
Normal file
47
migrations/Version20260219100826.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20260219100826 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE TABLE building_case (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, case_number INT NOT NULL, code VARCHAR(255) NOT NULL, capacity INT NOT NULL, id_building_id INT DEFAULT NULL, PRIMARY KEY (id))');
|
||||||
|
$this->addSql('CREATE INDEX IDX_DE2CEE505538B3E5 ON building_case (id_building_id)');
|
||||||
|
$this->addSql('CREATE TABLE building_case_position (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, x INT NOT NULL, y INT NOT NULL, w INT NOT NULL, h INT NOT NULL, render_order VARCHAR(255) NOT NULL, building_layout_id INT NOT NULL, building_case_id INT NOT NULL, PRIMARY KEY (id))');
|
||||||
|
$this->addSql('CREATE INDEX IDX_ACCDF9077040AE67 ON building_case_position (building_layout_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_ACCDF907F8D859DF ON building_case_position (building_case_id)');
|
||||||
|
$this->addSql('CREATE TABLE building_layout (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, name VARCHAR(255) NOT NULL, columns INT NOT NULL, rows INT NOT NULL, id_building_id INT NOT NULL, PRIMARY KEY (id))');
|
||||||
|
$this->addSql('CREATE INDEX IDX_2A8CB1095538B3E5 ON building_layout (id_building_id)');
|
||||||
|
$this->addSql('ALTER TABLE building_case ADD CONSTRAINT FK_DE2CEE505538B3E5 FOREIGN KEY (id_building_id) REFERENCES building (id)');
|
||||||
|
$this->addSql('ALTER TABLE building_case_position ADD CONSTRAINT FK_ACCDF9077040AE67 FOREIGN KEY (building_layout_id) REFERENCES building_layout (id) NOT DEFERRABLE');
|
||||||
|
$this->addSql('ALTER TABLE building_case_position ADD CONSTRAINT FK_ACCDF907F8D859DF FOREIGN KEY (building_case_id) REFERENCES building_case (id) NOT DEFERRABLE');
|
||||||
|
$this->addSql('ALTER TABLE building_layout ADD CONSTRAINT FK_2A8CB1095538B3E5 FOREIGN KEY (id_building_id) REFERENCES building (id) NOT DEFERRABLE');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE building_case DROP CONSTRAINT FK_DE2CEE505538B3E5');
|
||||||
|
$this->addSql('ALTER TABLE building_case_position DROP CONSTRAINT FK_ACCDF9077040AE67');
|
||||||
|
$this->addSql('ALTER TABLE building_case_position DROP CONSTRAINT FK_ACCDF907F8D859DF');
|
||||||
|
$this->addSql('ALTER TABLE building_layout DROP CONSTRAINT FK_2A8CB1095538B3E5');
|
||||||
|
$this->addSql('DROP TABLE building_case');
|
||||||
|
$this->addSql('DROP TABLE building_case_position');
|
||||||
|
$this->addSql('DROP TABLE building_layout');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Serializer\Attribute\Groups;
|
use Symfony\Component\Serializer\Attribute\Groups;
|
||||||
|
use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||||
|
|
||||||
#[ORM\Entity]
|
#[ORM\Entity]
|
||||||
#[ORM\Table(name: 'building')]
|
#[ORM\Table(name: 'building')]
|
||||||
@@ -48,9 +49,25 @@ class Building
|
|||||||
#[ORM\ManyToMany(targetEntity: Reception::class, mappedBy: 'buildings')]
|
#[ORM\ManyToMany(targetEntity: Reception::class, mappedBy: 'buildings')]
|
||||||
private Collection $receptions;
|
private Collection $receptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, BuildingCase>
|
||||||
|
*/
|
||||||
|
#[ORM\OneToMany(targetEntity: BuildingCase::class, mappedBy: 'id_building')]
|
||||||
|
private Collection $buildingCases;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, BuildingLayout>
|
||||||
|
*/
|
||||||
|
#[ORM\OneToMany(targetEntity: BuildingLayout::class, mappedBy: 'id_building')]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
#[SerializedName('layouts')]
|
||||||
|
private Collection $buildingLayout;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->receptions = new ArrayCollection();
|
$this->receptions = new ArrayCollection();
|
||||||
|
$this->buildingCases = new ArrayCollection();
|
||||||
|
$this->buildingLayout = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
@@ -89,4 +106,41 @@ class Building
|
|||||||
{
|
{
|
||||||
return $this->receptions;
|
return $this->receptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, BuildingCase>
|
||||||
|
*/
|
||||||
|
public function getBuildingCases(): Collection
|
||||||
|
{
|
||||||
|
return $this->buildingCases;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addBuildingCase(BuildingCase $buildingCase): static
|
||||||
|
{
|
||||||
|
if (!$this->buildingCases->contains($buildingCase)) {
|
||||||
|
$this->buildingCases->add($buildingCase);
|
||||||
|
$buildingCase->setIdBuilding($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeBuildingCase(BuildingCase $buildingCase): static
|
||||||
|
{
|
||||||
|
if ($this->buildingCases->removeElement($buildingCase)) {
|
||||||
|
if ($buildingCase->getIdBuilding() === $this) {
|
||||||
|
$buildingCase->setIdBuilding(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, BuildingLayout>
|
||||||
|
*/
|
||||||
|
public function getBuildingLayout(): Collection
|
||||||
|
{
|
||||||
|
return $this->buildingLayout;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
139
src/Entity/BuildingCase.php
Normal file
139
src/Entity/BuildingCase.php
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\BuildingCaseRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Serializer\Attribute\Groups;
|
||||||
|
use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: BuildingCaseRepository::class)]
|
||||||
|
class BuildingCase
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
#[SerializedName('caseNumber')]
|
||||||
|
private ?int $case_number = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?string $code = null;
|
||||||
|
|
||||||
|
#[ORM\Column]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?int $capacity = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, BuildingCasePosition>
|
||||||
|
*/
|
||||||
|
#[ORM\OneToMany(targetEntity: BuildingCasePosition::class, mappedBy: 'buildingCase')]
|
||||||
|
private Collection $id_case_position;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'buildingCases')]
|
||||||
|
private ?Building $id_building = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->id_case_position = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setId(int $id): static
|
||||||
|
{
|
||||||
|
$this->id = $id;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCaseNumber(): ?int
|
||||||
|
{
|
||||||
|
return $this->case_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCaseNumber(int $case_number): static
|
||||||
|
{
|
||||||
|
$this->case_number = $case_number;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCode(): ?string
|
||||||
|
{
|
||||||
|
return $this->code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCode(string $code): static
|
||||||
|
{
|
||||||
|
$this->code = $code;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCapacity(): ?int
|
||||||
|
{
|
||||||
|
return $this->capacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCapacity(int $capacity): static
|
||||||
|
{
|
||||||
|
$this->capacity = $capacity;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, BuildingCasePosition>
|
||||||
|
*/
|
||||||
|
public function getIdCasePosition(): Collection
|
||||||
|
{
|
||||||
|
return $this->id_case_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addIdCasePosition(BuildingCasePosition $idCasePosition): static
|
||||||
|
{
|
||||||
|
if (!$this->id_case_position->contains($idCasePosition)) {
|
||||||
|
$this->id_case_position->add($idCasePosition);
|
||||||
|
$idCasePosition->setBuildingCase($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeIdCasePosition(BuildingCasePosition $idCasePosition): static
|
||||||
|
{
|
||||||
|
if ($this->id_case_position->removeElement($idCasePosition)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($idCasePosition->getBuildingCase() === $this) {
|
||||||
|
$idCasePosition->setBuildingCase(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIdBuilding(): ?Building
|
||||||
|
{
|
||||||
|
return $this->id_building;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIdBuilding(?Building $id_building): static
|
||||||
|
{
|
||||||
|
$this->id_building = $id_building;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
146
src/Entity/BuildingCasePosition.php
Normal file
146
src/Entity/BuildingCasePosition.php
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\BuildingCasePositionRepository;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Serializer\Attribute\Groups;
|
||||||
|
use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: BuildingCasePositionRepository::class)]
|
||||||
|
class BuildingCasePosition
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?int $x = null;
|
||||||
|
|
||||||
|
#[ORM\Column]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?int $y = null;
|
||||||
|
|
||||||
|
#[ORM\Column]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?int $w = null;
|
||||||
|
|
||||||
|
#[ORM\Column]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?int $h = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
#[SerializedName('renderOrder')]
|
||||||
|
private ?string $render_order = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'id_case_position')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?BuildingLayout $buildingLayout = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'id_case_position')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?BuildingCase $buildingCase = null;
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setId(int $id): static
|
||||||
|
{
|
||||||
|
$this->id = $id;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getX(): ?int
|
||||||
|
{
|
||||||
|
return $this->x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setX(int $x): static
|
||||||
|
{
|
||||||
|
$this->x = $x;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getY(): ?int
|
||||||
|
{
|
||||||
|
return $this->y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setY(int $y): static
|
||||||
|
{
|
||||||
|
$this->y = $y;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getW(): ?int
|
||||||
|
{
|
||||||
|
return $this->w;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setW(int $w): static
|
||||||
|
{
|
||||||
|
$this->w = $w;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getH(): ?int
|
||||||
|
{
|
||||||
|
return $this->h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setH(int $h): static
|
||||||
|
{
|
||||||
|
$this->h = $h;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRenderOrder(): ?string
|
||||||
|
{
|
||||||
|
return $this->render_order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRenderOrder(string $render_order): static
|
||||||
|
{
|
||||||
|
$this->render_order = $render_order;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBuildingLayout(): ?BuildingLayout
|
||||||
|
{
|
||||||
|
return $this->buildingLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBuildingLayout(?BuildingLayout $buildingLayout): static
|
||||||
|
{
|
||||||
|
$this->buildingLayout = $buildingLayout;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBuildingCase(): ?BuildingCase
|
||||||
|
{
|
||||||
|
return $this->buildingCase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBuildingCase(?BuildingCase $buildingCase): static
|
||||||
|
{
|
||||||
|
$this->buildingCase = $buildingCase;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
141
src/Entity/BuildingLayout.php
Normal file
141
src/Entity/BuildingLayout.php
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use App\Repository\BuildingLayoutRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Serializer\Attribute\Groups;
|
||||||
|
use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||||
|
|
||||||
|
#[ORM\Entity(repositoryClass: BuildingLayoutRepository::class)]
|
||||||
|
class BuildingLayout
|
||||||
|
{
|
||||||
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\Column(length: 255)]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?string $name = null;
|
||||||
|
|
||||||
|
#[ORM\Column]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?int $columns = null;
|
||||||
|
|
||||||
|
#[ORM\Column]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
private ?int $rows = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(inversedBy: 'buildingLayout')]
|
||||||
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
|
private ?Building $id_building = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, BuildingCasePosition>
|
||||||
|
*/
|
||||||
|
#[ORM\OneToMany(targetEntity: BuildingCasePosition::class, mappedBy: 'buildingLayout')]
|
||||||
|
#[Groups(['building:read'])]
|
||||||
|
#[SerializedName('casePositions')]
|
||||||
|
private Collection $id_case_position;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->id_case_position = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setId(int $id): static
|
||||||
|
{
|
||||||
|
$this->id = $id;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(): ?string
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(string $name): static
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getColumns(): ?int
|
||||||
|
{
|
||||||
|
return $this->columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setColumns(int $columns): static
|
||||||
|
{
|
||||||
|
$this->columns = $columns;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRows(): ?int
|
||||||
|
{
|
||||||
|
return $this->rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRows(int $rows): static
|
||||||
|
{
|
||||||
|
$this->rows = $rows;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIdBuilding(): ?Building
|
||||||
|
{
|
||||||
|
return $this->id_building;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIdBuilding(?Building $id_building): static
|
||||||
|
{
|
||||||
|
$this->id_building = $id_building;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, BuildingCasePosition>
|
||||||
|
*/
|
||||||
|
public function getIdCasePosition(): Collection
|
||||||
|
{
|
||||||
|
return $this->id_case_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addIdCasePosition(BuildingCasePosition $idCasePosition): static
|
||||||
|
{
|
||||||
|
if (!$this->id_case_position->contains($idCasePosition)) {
|
||||||
|
$this->id_case_position->add($idCasePosition);
|
||||||
|
$idCasePosition->setBuildingLayout($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeIdCasePosition(BuildingCasePosition $idCasePosition): static
|
||||||
|
{
|
||||||
|
if ($this->id_case_position->removeElement($idCasePosition)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($idCasePosition->getBuildingLayout() === $this) {
|
||||||
|
$idCasePosition->setBuildingLayout(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user