-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sale] Add a component to calculate craft investment based on resourc…
…es bought + craft cost + runes investment
- Loading branch information
1 parent
3bb794c
commit 703a426
Showing
13 changed files
with
195 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
@import 'primeicons/primeicons.css'; | ||
|
||
@import 'primeflex/primeflex.scss'; | ||
@import 'primeflex/themes/primeone-dark.css'; | ||
@import 'primeflex/themes/primeone-dark.css'; | ||
|
||
* { | ||
font-family: Helvetica; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
assets/vue/src/package/sales/component/submodals/CalculateInvestment.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<script setup lang="ts"> | ||
import { ref } from "vue"; | ||
import { SalesEvent } from "../../domain/SalesEvent"; | ||
export interface SaveInvestmentPriceEvent { | ||
price: number | ||
} | ||
const emit = defineEmits<{ | ||
(event: SalesEvent.SAVE_INVESTMENT_PRICE, price: number): void | ||
}>() | ||
const visible = ref(false); | ||
const chatlog = ref(''); | ||
const craftInvestment = ref(0); | ||
const runeInvestment = ref(0); | ||
const totalInvestment = ref(0); | ||
const calculateTotal = () => { | ||
const re = /\] \(([\d\s]+)/g; | ||
let price = 0; | ||
let lastMatch; | ||
while (lastMatch = re.exec(chatlog.value)) { | ||
if (lastMatch[1]) { | ||
price += parseInt(lastMatch[1].replace(/ /g, '')) | ||
} | ||
// Avoid infinite loop | ||
if(!re.global) break; | ||
} | ||
totalInvestment.value = price + runeInvestment.value + craftInvestment.value | ||
} | ||
const resetForm = () => { | ||
chatlog.value = '' | ||
runeInvestment.value = 0 | ||
craftInvestment.value = 0 | ||
totalInvestment.value = 0 | ||
visible.value = false | ||
} | ||
const submitForm = () => { | ||
emit(SalesEvent.SAVE_INVESTMENT_PRICE, totalInvestment.value) | ||
resetForm() | ||
}; | ||
</script> | ||
|
||
<template> | ||
<Button icon="pi pi-calculator" severity="contrast" variant="text" @click="visible = true" /> | ||
|
||
<Dialog v-model:visible="visible" modal header="Calcul de l'investissement" style="width: 60%;"> | ||
<form @submit.prevent="submitForm"> | ||
<div class="grid"> | ||
<div class="col-6"> | ||
<IftaLabel> | ||
<Textarea id="chatlog" v-model="chatlog" rows="14" class="w-full" @input="calculateTotal" /> | ||
<label for="chatlog">Données de votre chat</label> | ||
</IftaLabel> | ||
</div> | ||
|
||
<div class="col-6"> | ||
<p class="mt-0">Vous pouvez copier/coller les achats faits à l'HDV pour calculer automatiquement la | ||
somme dépensée :</p> | ||
<img src="@/assets/images/investment_chatlog.png" alt="Chat Log" class=" border-1" /> | ||
</div> | ||
|
||
<InputGroup class="col-12"> | ||
<InputGroupAddon> | ||
<i class="pi pi-hammer"></i> | ||
</InputGroupAddon> | ||
<IftaLabel> | ||
<InputNumber suffix="k" v-model="craftInvestment" @value-change="calculateTotal" /> | ||
<label for="runeInvestment">Coût craft</label> | ||
</IftaLabel> | ||
</InputGroup> | ||
<InputGroup class="col-12"> | ||
<InputGroupAddon> | ||
<i class="pi pi-sparkles"></i> | ||
</InputGroupAddon> | ||
<IftaLabel> | ||
<InputNumber suffix="k" v-model="runeInvestment" @value-change="calculateTotal" /> | ||
<label for="runeInvestment">Investissement en runes</label> | ||
</IftaLabel> | ||
</InputGroup> | ||
|
||
<InputGroup class="col-12"> | ||
<InputGroupAddon> | ||
<i class="pi pi-dollar"></i> | ||
</InputGroupAddon> | ||
<IftaLabel> | ||
<InputNumber suffix="k" v-model="totalInvestment" disabled /> | ||
<label for="totalInvestment">Investissement</label> | ||
</IftaLabel> | ||
</InputGroup> | ||
</div> | ||
|
||
<div class="flex justify-content-end gap-2 mt-3"> | ||
<Button type="button" severity="secondary" @click="visible = false">Annuler</Button> | ||
<Button type="submit">Valider le calcul</Button> | ||
</div> | ||
</form> | ||
</Dialog> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export enum SalesEvent { | ||
REFRESH = 'sales:refresh', | ||
SAVE_INVESTMENT_PRICE = 'sales:save-investment-price' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,73 @@ | ||
<script setup lang="ts"> | ||
import { useAuthStore } from '../package/common/stores/authStore'; | ||
const authStore = useAuthStore(); | ||
</script> | ||
|
||
<template> | ||
<Suspense> | ||
<div class="min-h-[40rem] lg:min-h-0 bg-surface-0 dark:bg-surface-900 flex lg:flex-row flex-col"> | ||
<div class="flex lg:flex lg:flex-row flex-col justify-center md:justify-normal h-full flex-1"> | ||
<div class="relative flex-1 z-20 flex items-center justify-center"> | ||
<div class="flex items-center justify-center h-full"> | ||
<div class="w-full max-w-2xl px-6 py-12 lg:p-12 xl:p-16 text-center lg:text-left"> | ||
<h1 | ||
class="text-4xl xl:text-5xl font-bold text-surface-0 lg:text-surface-900 dark:text-surface-0 mb-4 !leading-tight"> | ||
<span class="block">Gérer plus simplement</span> | ||
<span class="block text-primary">vos ventes Dofus</span> | ||
</h1> | ||
|
||
<p | ||
class="text-surface-0/90 lg:text-surface-700 dark:text-surface-200 text-xl leading-normal mb-4 max-w-xl lg:max-w-none"> | ||
<ul class="list-none line-height-3 p-0"> | ||
<li>Modification du prix avec recalcul automatique de la taxe HDV</li> | ||
<li>Calcul auto des achats effectués en HDV via un simple copier/coller</li> | ||
<li>Statistiques de ventes (investissement, profit...)</li> | ||
</ul> | ||
</p> | ||
|
||
<div class="flex items-center gap-4 justify-center lg:justify-start"> | ||
<RouterLink to="/register"> | ||
<Button label="S'inscrire" icon="pi pi-user" /> | ||
</RouterLink> | ||
</div> | ||
<div class="min-h-[40rem] lg:min-h-0 bg-surface-0 dark:bg-surface-900 flex lg:flex-row flex-col"> | ||
<div class="flex lg:flex lg:flex-row flex-col justify-center md:justify-normal h-full flex-1"> | ||
<div class="relative flex-1 z-20 flex items-center justify-center"> | ||
<div class="flex items-center justify-center h-full"> | ||
<div class="w-full max-w-2xl px-6 py-12 lg:p-12 xl:p-16 text-center lg:text-left"> | ||
<h1 | ||
class="text-4xl xl:text-5xl font-bold text-surface-0 lg:text-surface-900 dark:text-surface-0 mb-4 !leading-tight"> | ||
<span class="block">Gérer plus simplement</span> | ||
<span class="block text-primary">vos ventes Dofus</span> | ||
</h1> | ||
|
||
<p | ||
class="text-surface-0/90 lg:text-surface-700 dark:text-surface-200 text-xl leading-normal mb-4 max-w-xl lg:max-w-none"> | ||
<ul class="list-none line-height-3 p-0"> | ||
<li>Modification du prix avec recalcul automatique de la taxe HDV</li> | ||
<li>Statistiques de ventes (investissement, profit...)</li> | ||
</ul> | ||
</p> | ||
|
||
<div class="flex items-center gap-4 justify-center lg:justify-start" v-if="!authStore.user"> | ||
<RouterLink to="/register"> | ||
<Button label="S'inscrire" icon="pi pi-user" /> | ||
</RouterLink> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="absolute lg:relative inset-0 lg:inset-auto flex-1 mt-2"> | ||
<div class="absolute lg:hidden inset-0 bg-surface-900/60 dark:bg-surface-900/80 z-10" /> | ||
<img src="@/assets/sales.png" alt="Ventes" class="h-full object-cover border-2" /> | ||
</div> | ||
<div class="absolute lg:relative inset-0 lg:inset-auto flex-1 mt-2"> | ||
<div class="absolute lg:hidden inset-0 bg-surface-900/60 dark:bg-surface-900/80 z-10" /> | ||
<img src="@/assets/images/sales.png" alt="Ventes" class="h-full object-cover border-2" /> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<hr class="mt-4 border-primary-500"> | ||
|
||
<div class="min-h-[40rem] lg:min-h-0 bg-surface-0 dark:bg-surface-900 flex lg:flex-row flex-col mt-4"> | ||
<div class="flex lg:flex lg:flex-row flex-col justify-center md:justify-normal h-full flex-1"> | ||
<div class="absolute lg:relative inset-0 lg:inset-auto flex-1 mt-2"> | ||
<div class="absolute lg:hidden inset-0 bg-surface-900/60 dark:bg-surface-900/80 z-10" /> | ||
<img src="@/assets/images/sales_investment.png" alt="Ventes" class="h-full object-cover border-1 border-gray-500" style="max-width: 800px;" /> | ||
</div> | ||
</div> | ||
</Suspense> | ||
|
||
<div class="relative flex-1 z-20 flex items-center justify-center"> | ||
<div class="flex items-center justify-center h-full"> | ||
<div class="w-full max-w-2xl px-6 py-12 lg:p-12 xl:p-16 text-center lg:text-left"> | ||
<h1 | ||
class="text-4xl xl:text-5xl font-bold text-surface-0 lg:text-surface-900 dark:text-surface-0 mb-4 !leading-tight"> | ||
<span class="block">Calculer automatiquement</span> | ||
<span class="block text-primary">l'investissement des crafts</span> | ||
</h1> | ||
|
||
<p | ||
class="text-surface-0/90 lg:text-surface-700 dark:text-surface-200 text-xl leading-normal mb-4 max-w-xl lg:max-w-none"> | ||
<ul class="list-none line-height-3 p-0"> | ||
<li>Calcul auto des achats effectués en HDV via un simple copier/coller</li> | ||
<li>Prise en compte du paiement du coût du craft + dépenses en runes</li> | ||
</ul> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> |