Skip to content

Commit

Permalink
Ajoute la création / suppression de devis pour les événements (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
polosson committed Apr 21, 2021
1 parent b1416dc commit 9f04d00
Show file tree
Hide file tree
Showing 46 changed files with 3,397 additions and 717 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Tous les changements notables sur le projet sont documentés dans ce fichier.

Ce projet adhère au principe du [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.13.0 (UNRELEASED)

- Ajoute la création / suppression de devis pour les événements (#5).

## 0.12.0 (2021-03-29)

- Améliore le calcul du matériel restant dans les événements.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.BillEstimateCreationForm {
&__discount-input .FormField__input {
max-width: 90px;
}

&__discount-target-input .FormField__input {
max-width: 110px;
}

&__beneficiary {
display: flex;
flex-direction: column;
margin-top: $content-padding-small-vertical;

&__label {
display: block;
padding: 5px 0;
}
}

&__save {
margin-top: $content-padding-large-vertical;
}

@media(min-width: $screen-tablet) {
&__beneficiary {
flex-direction: row;
align-items: center;
height: 2.5rem;

&__label {
flex: 0 0 $form-label-width;
padding: 0 $input-padding-horizontal;
text-align: right;
}

&__name {
flex: 1;
}
}

&__save {
margin-top: $content-padding-small-vertical;
padding-left: $form-label-width;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<template>
<form
class="Form BillEstimateCreationForm"
method="POST"
@submit="handleSubmit"
>
<div class="Form__fieldset">
<h4 class="Form__fieldset__title">{{ $t('discount') }}</h4>
<FormField
:value="discountRate"
class="BillEstimateCreationForm__discount-input"
name="discountRate"
type="number"
:step="0.0001"
:min="0.0"
:max="99.9999"
addon="%"
label="wanted-rate"
@change="handleChangeRate"
:disabled="loading"
/>
<FormField
:value="discountTarget"
class="BillEstimateCreationForm__discount-target-input"
name="discountTarget"
type="number"
:step="0.01"
:min="0"
:max="maxAmount"
:addon="currency"
label="wanted-amount"
@change="handleChangeAmount"
:disabled="loading"
/>
<div class="BillEstimateCreationForm__beneficiary">
<div class="BillEstimateCreationForm__beneficiary__label">
{{ $t('beneficiary') }}
</div>
<div class="BillEstimateCreationForm__beneficiary__name">
<router-link
:to="`/beneficiaries/${beneficiary.id}`"
:title="$t('action-edit')"
>
{{ beneficiary.full_name }}
</router-link>
</div>
</div>
</div>
<div class="BillEstimateCreationForm__save">
<button class="success" type="submit" :disabled="loading">
<i v-if="loading" class="fas fa-circle-notch fa-spin" />
<i v-else class="fas fa-plus" />
{{ saveLabel }}
</button>
<button v-if="isRegeneration" @click="$emit('cancel')" type="button" :disabled="loading">
{{ $t('cancel') }}
</button>
</div>
</form>
</template>

<style lang="scss">
@import '../../themes/default/index';
@import './BillEstimateCreationForm';
</style>

<script src="./index.js"></script>
35 changes: 35 additions & 0 deletions client/src/components/BillEstimateCreationForm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import Config from '@/config/globalConfig';
import FormField from '@/components/FormField/FormField.vue';

export default {
name: 'BillEstimateCreationForm',
components: { FormField },
props: {
discountRate: Number,
discountTarget: Number,
maxAmount: Number,
beneficiary: Object,
saveLabel: String,
isRegeneration: Boolean,
loading: Boolean,
},
data() {
return {
currency: Config.currency.symbol,
};
},
methods: {
handleChangeRate(value) {
this.$emit('change', { field: 'rate', value: Number.parseFloat(value) });
},

handleChangeAmount(value) {
this.$emit('change', { field: 'amount', value: Number.parseFloat(value) });
},

handleSubmit(e) {
e.preventDefault();
this.$emit('submit');
},
},
};
109 changes: 29 additions & 80 deletions client/src/components/EventBilling/EventBilling.scss
Original file line number Diff line number Diff line change
@@ -1,93 +1,42 @@
.EventBilling {
&__last-bill {
margin-bottom: $content-padding-large-vertical;
margin-bottom: $content-padding-large-vertical;

&__no-bill,
&__regenerate__text {
margin: 0 0 .5rem;
color: $text-light-color;
font-style: italic;
margin-bottom: $content-padding-large-vertical;
}

&__not-billable {
color: $text-danger-color;

&__text {
margin: 0;
font-style: italic;
}
}

&__discount-input .FormField__input {
max-width: 90px;
}

&__discount-target-input .FormField__input {
max-width: 110px;
}

&__beneficiary {
display: flex;
flex-direction: column;
margin-top: $content-padding-small-vertical;

&__label {
display: block;
padding: 5px 0;
}
}

&__save {
margin-top: 1.2rem;
}
&__no-bill,
&__regenerate__text {
margin: 0 0 $content-padding-large-horizontal;
color: $text-light-color;
font-style: italic;
}

&__download {
font-size: 1.1rem;
margin-bottom: 1rem;
&__no-estimate {
margin: 0 0 $content-padding-large-horizontal;
color: $text-warning-color;
font-size: 1.1rem;
}

&__text {
margin: 0 0 .5rem;
}
&__not-billable {
color: $text-danger-color;

&__link {
display: inline-block;
margin-top: .5rem;
padding: 1rem 1rem 1rem .5rem;
border: 1px solid;
border-radius: $input-border-radius;
}
}

.fas {
width: 1.5rem;
margin-right: .5rem;
text-align: center;
&__text {
margin: 0;
font-style: italic;
}
}

@media(min-width: $screen-tablet) {
&__last-bill {
&__beneficiary {
flex-direction: row;
align-items: center;
height: 2.5rem;

&__label {
flex: 0 0 $form-label-width;
padding: 0 $input-padding-horizontal;
text-align: right;
}
&__download {
font-size: 1.1rem;
margin-bottom: 1rem;

&__name {
flex: 1;
}
}
&__text {
margin: 0 0 .5rem;
}

&__save {
margin-top: 1rem;
padding-left: $form-label-width;
}
&__link {
display: inline-block;
margin-top: .5rem;
padding: 1rem 1rem 1rem .5rem;
border: 1px solid;
border-radius: $input-border-radius;
}
}
}
Loading

0 comments on commit 9f04d00

Please sign in to comment.