mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-02 21:08:12 +00:00
fix: button style
This commit is contained in:
@@ -81,27 +81,15 @@
|
|||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<div class="tab_actions">
|
<div class="tab_actions">
|
||||||
<button
|
<button class="btn" :data-disabled="computedChosenCarTypes.size == 0" @click="generateStock()">
|
||||||
class="btn"
|
|
||||||
:data-disabled="computedChosenCarTypes.size == 0"
|
|
||||||
@click="generateStock()"
|
|
||||||
>
|
|
||||||
{{ $t('stockgen.action-generate') }}
|
{{ $t('stockgen.action-generate') }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button class="btn" :data-disabled="computedChosenCarTypes.size == 0" @click="generateStock(true)">
|
||||||
class="btn"
|
|
||||||
:data-disabled="computedChosenCarTypes.size == 0"
|
|
||||||
@click="generateStock(true)"
|
|
||||||
>
|
|
||||||
{{ $t('stockgen.action-generate-empty') }}
|
{{ $t('stockgen.action-generate-empty') }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button class="btn" :data-disabled="computedChosenCarTypes.size == 0" @click="resetChosenCargo">
|
||||||
class="btn"
|
|
||||||
:data-disabled="computedChosenCarTypes.size == 0"
|
|
||||||
@click="resetChosenCargo"
|
|
||||||
>
|
|
||||||
{{ $t('stockgen.action-reset') }}
|
{{ $t('stockgen.action-reset') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -183,9 +171,7 @@ export default defineComponent({
|
|||||||
if (!this.isCarGroupingEnabled) return false;
|
if (!this.isCarGroupingEnabled) return false;
|
||||||
|
|
||||||
stockList.sort((s1, s2) => {
|
stockList.sort((s1, s2) => {
|
||||||
return (s1.vehicleRef.constructionType + s1.cargo?.id).localeCompare(
|
return (s1.vehicleRef.constructionType + s1.cargo?.id).localeCompare(s2.vehicleRef.constructionType + s2.cargo?.id);
|
||||||
s2.vehicleRef.constructionType + s2.cargo?.id
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -202,14 +188,11 @@ export default defineComponent({
|
|||||||
|
|
||||||
if (!cargoType || empty) cargoObjs.push(undefined);
|
if (!cargoType || empty) cargoObjs.push(undefined);
|
||||||
else if (cargoType == 'all') cargoObjs.push(...carWagonObjs[0]!.cargoTypes);
|
else if (cargoType == 'all') cargoObjs.push(...carWagonObjs[0]!.cargoTypes);
|
||||||
else
|
else cargoObjs.push(carWagonObjs[0]?.cargoTypes.find((cargo) => cargo.id == cargoType));
|
||||||
cargoObjs.push(carWagonObjs[0]?.cargoTypes.find((cargo) => cargo.id == cargoType));
|
|
||||||
|
|
||||||
carWagonObjs.forEach((cw) => {
|
carWagonObjs.forEach((cw) => {
|
||||||
cargoObjs.forEach((cargoObj) => {
|
cargoObjs.forEach((cargoObj) => {
|
||||||
const chosenStock = acc.find((a) =>
|
const chosenStock = acc.find((a) => a.constructionType.includes(cw.constructionType));
|
||||||
a.constructionType.includes(cw.constructionType)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!chosenStock)
|
if (!chosenStock)
|
||||||
acc.push({
|
acc.push({
|
||||||
@@ -229,24 +212,15 @@ export default defineComponent({
|
|||||||
let bestGeneration: { stockList: IStock[]; value: number } = { stockList: [], value: 0 };
|
let bestGeneration: { stockList: IStock[]; value: number } = { stockList: [], value: 0 };
|
||||||
|
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
this.store.stockList.splice(
|
this.store.stockList.splice(this.store.stockList.length > 0 && isTractionUnit(this.store.stockList[0].vehicleRef) ? 1 : 0);
|
||||||
this.store.stockList.length > 0 && isTractionUnit(this.store.stockList[0].vehicleRef)
|
|
||||||
? 1
|
|
||||||
: 0
|
|
||||||
);
|
|
||||||
|
|
||||||
let carCount = 0;
|
let carCount = 0;
|
||||||
const maxWeight =
|
const maxWeight = this.store.acceptableWeight > 0 ? Math.min(this.store.acceptableWeight, this.maxTons * 1000) : this.maxTons * 1000;
|
||||||
this.store.acceptableWeight > 0
|
|
||||||
? Math.min(this.store.acceptableWeight, this.maxTons * 1000)
|
|
||||||
: this.maxTons * 1000;
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-constant-condition
|
// eslint-disable-next-line no-constant-condition
|
||||||
while (true) {
|
while (true) {
|
||||||
const randomStockType =
|
const randomStockType = generatedChosenStockList[~~(Math.random() * generatedChosenStockList.length)];
|
||||||
generatedChosenStockList[~~(Math.random() * generatedChosenStockList.length)];
|
const { carWagon, cargo } = randomStockType.carPool[~~(Math.random() * randomStockType.carPool.length)];
|
||||||
const { carWagon, cargo } =
|
|
||||||
randomStockType.carPool[~~(Math.random() * randomStockType.carPool.length)];
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.store.totalWeight + (carWagon.weight + (cargo?.weight ?? 0)) > maxWeight ||
|
this.store.totalWeight + (carWagon.weight + (cargo?.weight ?? 0)) > maxWeight ||
|
||||||
@@ -335,8 +309,6 @@ h2 {
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
background-color: var(--secondaryColor);
|
|
||||||
|
|
||||||
&[data-excluded='true'] {
|
&[data-excluded='true'] {
|
||||||
background-color: gray;
|
background-color: gray;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user