-
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.
Merge pull request #59 from heseya/SK-922
manufacturers
- Loading branch information
Showing
13 changed files
with
584 additions
and
10 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 |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<template> | ||
<div class="manufacturers"> | ||
<div class="manufacturers__fields"> | ||
<validated-input | ||
v-model="form.name" | ||
:disabled="disabled" | ||
rules="required" | ||
name="name" | ||
:label="$t('name')" | ||
/> | ||
<validated-input | ||
v-model="form.email" | ||
:disabled="disabled" | ||
rules="required|email" | ||
name="email" | ||
:label="$t('email')" | ||
/> | ||
<validated-input | ||
v-model="form.first_name" | ||
:disabled="disabled" | ||
name="first_name" | ||
:label="$t('firstName')" | ||
/> | ||
<validated-input | ||
v-model="form.last_name" | ||
:disabled="disabled" | ||
name="last_name" | ||
:label="$t('lastName')" | ||
/> | ||
</div> | ||
<hr /> | ||
<div> | ||
<h2 class="manufacturers__title">{{ $t('relatedProducts') }}</h2> | ||
<autocomplete-input | ||
key="product_ids" | ||
v-model="form.product_ids" | ||
:label="`${$t('products')}`" | ||
model-url="products" | ||
prop-mode="id" | ||
:disabled="disabled" | ||
:rules="{ required: form.product_ids && form.product_ids.length === 0 }" | ||
class="sale-configurator__autocomplete" | ||
> | ||
<template #option="product"> | ||
{{ product.name }} <small>(/{{ product.slug }})</small> | ||
</template> | ||
</autocomplete-input> | ||
</div> | ||
<hr /> | ||
<h2 class="manufacturers__title">{{ $t('manufactureAddress') }}</h2> | ||
<div class="manufacturers__address-fields"> | ||
<address-form v-model="form.address" /> | ||
</div> | ||
</div> | ||
</template> | ||
<i18n lang="json"> | ||
{ | ||
"pl": { | ||
"name": "Nazwa", | ||
"email": "Email", | ||
"lastName": "Nazwisko", | ||
"firstName": "Imię", | ||
"products": "Produkty", | ||
"manufactureAddress": "Adres Producenta", | ||
"relatedProducts": "Produkty powiązane" | ||
}, | ||
"en": { | ||
"name": "Name", | ||
"email": "Email", | ||
"lastName": "Last Name", | ||
"firstName": "First Name", | ||
"products": "Products", | ||
"manufactureAddress": "Manufacture address", | ||
"relatedProducts": "Related products" | ||
} | ||
} | ||
</i18n> | ||
<script lang="ts"> | ||
import { defineComponent, PropType } from 'vue' | ||
import { ManufacturerDto } from '@heseya/store-core' | ||
import AutocompleteInput from '@/components/AutocompleteInput.vue' | ||
import AddressForm from '@/components/modules/orders/AddressForm.vue' | ||
export type ManufacturerForm = ManufacturerDto & { id?: string } | ||
export default defineComponent({ | ||
components: { | ||
AutocompleteInput, | ||
AddressForm, | ||
}, | ||
props: { | ||
value: { | ||
type: Object as PropType<ManufacturerForm>, | ||
required: true, | ||
}, | ||
disabled: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}, | ||
computed: { | ||
form: { | ||
get(): ManufacturerDto { | ||
console.log('form', this.value) | ||
Check warning on line 104 in src/components/modules/manufacturers/Form.vue GitHub Actions / eslint
|
||
return this.value | ||
}, | ||
set(v: ManufacturerDto) { | ||
this.$emit('input', v) | ||
}, | ||
}, | ||
}, | ||
methods: {}, | ||
}) | ||
</script> | ||
<style lang="scss" scoped> | ||
.manufacturers { | ||
&__fields { | ||
display: grid; | ||
gap: 6px; | ||
grid-template-areas: | ||
'name email' | ||
'first_name last_name'; | ||
} | ||
&__address-fields { | ||
display: grid; | ||
gap: 6px; | ||
} | ||
&__title { | ||
margin-right: 12px; | ||
font-size: 1.1em; | ||
font-weight: 500; | ||
} | ||
} | ||
</style> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Manufacturer, ManufacturerDto } from '@heseya/store-core' | ||
import { GLOBAL_QUERY_PARAMS, createVuexCRUD } from './generator' | ||
|
||
export const manufacturers = createVuexCRUD<Manufacturer, ManufacturerDto, ManufacturerDto>()( | ||
'manufacturers', | ||
{ | ||
state: {}, | ||
getters: {}, | ||
mutations: {}, | ||
actions: {}, | ||
}, | ||
{ | ||
get: { lang_fallback: 'any' }, | ||
getOne: GLOBAL_QUERY_PARAMS, | ||
add: GLOBAL_QUERY_PARAMS, | ||
edit: GLOBAL_QUERY_PARAMS, | ||
update: GLOBAL_QUERY_PARAMS, | ||
}, | ||
) |
Oops, something went wrong.