2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

feat: Text control

This commit is contained in:
Faris Ansari 2020-02-03 23:10:21 +05:30
parent 4784cd5793
commit 0d431ae9c6
3 changed files with 45 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import DynamicLink from './DynamicLink';
import Int from './Int';
import Float from './Float';
import Currency from './Currency';
import Text from './Text';
export default {
name: 'FormControl',
@ -26,7 +27,8 @@ export default {
DynamicLink,
Int,
Float,
Currency
Currency,
Text,
};
let { df } = this.$attrs;
return h(controls[df.fieldtype] || Data, {

View File

@ -0,0 +1,27 @@
<template>
<div>
<div class="text-gray-600 text-sm mb-1" v-if="showLabel">
{{ df.label }}
</div>
<textarea
ref="input"
rows="3"
:class="['resize-none', inputClasses]"
:value="value"
:placeholder="inputPlaceholder"
:readonly="isReadOnly"
@blur="e => triggerChange(e.target.value)"
@focus="e => $emit('focus', e)"
@input="e => $emit('input', e)"
></textarea>
</div>
</template>
<script>
import Base from './Base';
export default {
name: 'Text',
extends: Base
};
</script>

View File

@ -119,7 +119,21 @@
/>
</div>
</div>
<div class="px-6 mb-6 flex justify-end text-base">
<div
class="px-6 mb-6 flex justify-between text-base"
v-if="doc.items.length"
>
<div class="flex-1 mr-10">
<FormControl
v-if="!doc.submitted || doc.terms"
:df="meta.getField('terms')"
:value="doc.terms"
:show-label="true"
input-class="bg-gray-100"
@change="value => doc.set('terms', value)"
:read-only="doc.submitted"
/>
</div>
<div class="w-64">
<div class="flex pl-2 justify-between py-3 border-b">
<div>{{ _('Subtotal') }}</div>