chore: install prettier
This commit is contained in:
@@ -10,7 +10,12 @@
|
||||
<div class="field">
|
||||
<label class="label">Thứ tự</label>
|
||||
<div class="control">
|
||||
<input class="input" type="number" v-model.number="record.index" placeholder="Thứ tự" />
|
||||
<input
|
||||
class="input"
|
||||
type="number"
|
||||
v-model.number="record.index"
|
||||
placeholder="Thứ tự"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -19,9 +24,20 @@
|
||||
<div class="field">
|
||||
<label class="label">Mã <span class="has-text-danger">*</span></label>
|
||||
<div class="control">
|
||||
<input class="input" type="text" v-model="record.code" id="code" placeholder="Mã CS" />
|
||||
<input
|
||||
class="input"
|
||||
type="text"
|
||||
v-model="record.code"
|
||||
id="code"
|
||||
placeholder="Mã CS"
|
||||
/>
|
||||
</div>
|
||||
<p class="help is-danger" v-if="errors.code">{{ errors.code }}</p>
|
||||
<p
|
||||
class="help is-danger"
|
||||
v-if="errors.code"
|
||||
>
|
||||
{{ errors.code }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,9 +45,19 @@
|
||||
<div class="field">
|
||||
<label class="label">Tên chính sách <span class="has-text-danger">*</span></label>
|
||||
<div class="control">
|
||||
<input class="input" type="text" v-model="record.name" placeholder="Tên" />
|
||||
<input
|
||||
class="input"
|
||||
type="text"
|
||||
v-model="record.name"
|
||||
placeholder="Tên"
|
||||
/>
|
||||
</div>
|
||||
<p class="help is-danger" v-if="errors.name">{{ errors.name }}</p>
|
||||
<p
|
||||
class="help is-danger"
|
||||
v-if="errors.name"
|
||||
>
|
||||
{{ errors.name }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -39,13 +65,21 @@
|
||||
<div class="field">
|
||||
<label class="label">Đặt cọc <span class="has-text-danger">*</span></label>
|
||||
<div class="control">
|
||||
<InputNumber v-bind="{
|
||||
record: record,
|
||||
attr: 'deposit',
|
||||
defaultValue: true,
|
||||
}" @number="selected('deposit', $event)" />
|
||||
<InputNumber
|
||||
v-bind="{
|
||||
record: record,
|
||||
attr: 'deposit',
|
||||
defaultValue: true,
|
||||
}"
|
||||
@number="selected('deposit', $event)"
|
||||
/>
|
||||
</div>
|
||||
<p class="help is-danger" v-if="errors.deposit">{{ errors.deposit }}</p>
|
||||
<p
|
||||
class="help is-danger"
|
||||
v-if="errors.deposit"
|
||||
>
|
||||
{{ errors.deposit }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -53,23 +87,38 @@
|
||||
<div class="field">
|
||||
<label class="label">PT thanh toán <span class="has-text-danger">*</span></label>
|
||||
<div class="control">
|
||||
<SearchBox v-bind="{
|
||||
api: 'paymentmethod',
|
||||
field: 'name',
|
||||
column: ['name'],
|
||||
first: true,
|
||||
optionid: record.method
|
||||
}" @option="selected('method', $event)" />
|
||||
<SearchBox
|
||||
v-bind="{
|
||||
api: 'paymentmethod',
|
||||
field: 'name',
|
||||
column: ['name'],
|
||||
first: true,
|
||||
optionid: record.method,
|
||||
}"
|
||||
@option="selected('method', $event)"
|
||||
/>
|
||||
</div>
|
||||
<p class="help is-danger" v-if="errors.method">{{ errors.method }}</p>
|
||||
<p
|
||||
class="help is-danger"
|
||||
v-if="errors.method"
|
||||
>
|
||||
{{ errors.method }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="column is-3">
|
||||
<div class="column is-3">
|
||||
<div class="field">
|
||||
<label class="label">% Phân bổ HĐ</label>
|
||||
<div class="control">
|
||||
<input class="input" type="number" v-model.number="record.contract_allocation_percentage" placeholder="%" min="0" max="100" />
|
||||
<input
|
||||
class="input"
|
||||
type="number"
|
||||
v-model.number="record.contract_allocation_percentage"
|
||||
placeholder="%"
|
||||
min="0"
|
||||
max="100"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -81,16 +130,24 @@
|
||||
<span class="has-text-danger">*</span>
|
||||
</label>
|
||||
<div class="control">
|
||||
<div class="is-flex is-align-items-center is-clickable is-gap-2" @click="record.enable = !record.enable">
|
||||
<SvgIcon v-bind="{
|
||||
name: record.enable ? 'checked.svg' : 'uncheck.svg',
|
||||
type: record.enable ? 'primary' : 'twitter',
|
||||
size: 22
|
||||
}" />
|
||||
<div
|
||||
class="is-flex is-align-items-center is-clickable is-gap-2"
|
||||
@click="record.enable = !record.enable"
|
||||
>
|
||||
<SvgIcon
|
||||
v-bind="{
|
||||
name: record.enable ? 'checked.svg' : 'uncheck.svg',
|
||||
type: record.enable ? 'primary' : 'twitter',
|
||||
size: 22,
|
||||
}"
|
||||
/>
|
||||
<span>Cho phép</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="help is-danger" v-if="errors.enable">
|
||||
<p
|
||||
class="help is-danger"
|
||||
v-if="errors.enable"
|
||||
>
|
||||
{{ errors.enable }}
|
||||
</p>
|
||||
</div>
|
||||
@@ -102,19 +159,36 @@
|
||||
<Caption v-bind="{ title: 'Kế hoạch thanh toán', type: 'has-text-warning' }"></Caption>
|
||||
</div>
|
||||
|
||||
<div class="p-3" v-for="(plan, i) in paymentPlans" :key="i" style="position: relative;">
|
||||
<a v-if="paymentPlans.length > 1" class="has-text-danger is-size-7"
|
||||
style="position: absolute; top: 0.5rem; right: 0.75rem; cursor: pointer;" @click="removePlan(plan, i)">
|
||||
<div
|
||||
class="p-3"
|
||||
v-for="(plan, i) in paymentPlans"
|
||||
:key="i"
|
||||
style="position: relative"
|
||||
>
|
||||
<a
|
||||
v-if="paymentPlans.length > 1"
|
||||
class="has-text-danger is-size-7"
|
||||
style="position: absolute; top: 0.5rem; right: 0.75rem; cursor: pointer"
|
||||
@click="removePlan(plan, i)"
|
||||
>
|
||||
Xóa
|
||||
</a>
|
||||
<div class="columns is-multiline is-mobile mb-0" style="border-top: 1px solid #dbdbdb;">
|
||||
<div
|
||||
class="columns is-multiline is-mobile mb-0"
|
||||
style="border-top: 1px solid #dbdbdb"
|
||||
>
|
||||
<!-- Đợt -->
|
||||
<div class="column is-3-desktop is-2-mobile pb-0">
|
||||
<div class="field">
|
||||
<label class="label">Đợt</label>
|
||||
<div class="control">
|
||||
<input class="input has-text-centered has-text-weight-bold" type="text" :value="i + 1" disabled
|
||||
style="background-color: #f5f5f5;" />
|
||||
<input
|
||||
class="input has-text-centered has-text-weight-bold"
|
||||
type="text"
|
||||
:value="i + 1"
|
||||
disabled
|
||||
style="background-color: #f5f5f5"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -124,8 +198,14 @@
|
||||
<div class="field">
|
||||
<label class="label">Giá trị <span class="has-text-danger">*</span></label>
|
||||
<div class="control">
|
||||
<input class="input" type="number" v-model.number="plan.value" placeholder="Giá trị" min="0"
|
||||
step="0.01" />
|
||||
<input
|
||||
class="input"
|
||||
type="number"
|
||||
v-model.number="plan.value"
|
||||
placeholder="Giá trị"
|
||||
min="0"
|
||||
step="0.01"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -135,13 +215,16 @@
|
||||
<div class="field">
|
||||
<label class="label">Loại <span class="has-text-danger">*</span></label>
|
||||
<div class="control">
|
||||
<SearchBox v-bind="{
|
||||
api: 'valuetype',
|
||||
field: 'name',
|
||||
column: ['name'],
|
||||
first: true,
|
||||
optionid: plan.type
|
||||
}" @option="planSelected('type', $event, plan)" />
|
||||
<SearchBox
|
||||
v-bind="{
|
||||
api: 'valuetype',
|
||||
field: 'name',
|
||||
column: ['name'],
|
||||
first: true,
|
||||
optionid: plan.type,
|
||||
}"
|
||||
@option="planSelected('type', $event, plan)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -151,7 +234,13 @@
|
||||
<div class="field">
|
||||
<label class="label">Số ngày</label>
|
||||
<div class="control">
|
||||
<input class="input" type="number" v-model.number="plan.days" placeholder="Ngày" min="0" />
|
||||
<input
|
||||
class="input"
|
||||
type="number"
|
||||
v-model.number="plan.days"
|
||||
placeholder="Ngày"
|
||||
min="0"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -161,7 +250,12 @@
|
||||
<div class="field">
|
||||
<label class="label">Ghi chú TT</label>
|
||||
<div class="control">
|
||||
<input class="input" type="text" v-model="plan.payment_note" placeholder="Ghi chú thanh toán" />
|
||||
<input
|
||||
class="input"
|
||||
type="text"
|
||||
v-model="plan.payment_note"
|
||||
placeholder="Ghi chú thanh toán"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -171,7 +265,12 @@
|
||||
<div class="field mb-0">
|
||||
<label class="label">Ghi chú hạn</label>
|
||||
<div class="control">
|
||||
<input class="input" type="text" v-model="plan.due_note" placeholder="Ghi chú hạn thanh toán" />
|
||||
<input
|
||||
class="input"
|
||||
type="text"
|
||||
v-model="plan.due_note"
|
||||
placeholder="Ghi chú hạn thanh toán"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -179,23 +278,39 @@
|
||||
</div>
|
||||
|
||||
<!-- Nút thêm -->
|
||||
<button class="button is-pulled-right is-info is-light mb-4" @click="addPlan">
|
||||
<button
|
||||
class="button is-pulled-right is-info is-light mb-4"
|
||||
@click="addPlan"
|
||||
>
|
||||
<span class="icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="12" width="12" viewBox="0 0 448 512">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
height="12"
|
||||
width="12"
|
||||
viewBox="0 0 448 512"
|
||||
>
|
||||
<path
|
||||
d="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 144L48 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l144 0 0 144c0 17.7 14.3 32 32 32s32-14.3 32-32l0-144 144 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-144 0 0-144z" />
|
||||
d="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 144L48 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l144 0 0 144c0 17.7 14.3 32 32 32s32-14.3 32-32l0-144 144 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-144 0 0-144z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<!-- Action buttons -->
|
||||
<div class="buttons">
|
||||
<button :class="`button has-text-white is-primary ${isSubmitting ? 'is-loading' : ''}`" @click="update()"
|
||||
:disabled="isSubmitting">
|
||||
<button
|
||||
:class="`button has-text-white is-primary ${isSubmitting ? 'is-loading' : ''}`"
|
||||
@click="update()"
|
||||
:disabled="isSubmitting"
|
||||
>
|
||||
<span>Lưu</span>
|
||||
</button>
|
||||
|
||||
<button class="button has-text-white is-danger" @click="emit('close')" :disabled="isSubmitting">
|
||||
<button
|
||||
class="button has-text-white is-danger"
|
||||
@click="emit('close')"
|
||||
:disabled="isSubmitting"
|
||||
>
|
||||
<span>Hủy</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -262,7 +377,7 @@ async function update() {
|
||||
isSubmitting.value = true;
|
||||
|
||||
let policyData = $resetNull(record.value);
|
||||
if (policyData.method && typeof policyData.method === 'object') {
|
||||
if (policyData.method && typeof policyData.method === "object") {
|
||||
policyData.method = policyData.method.id;
|
||||
}
|
||||
|
||||
@@ -274,7 +389,7 @@ async function update() {
|
||||
throw new Error("Failed to save policy");
|
||||
}
|
||||
|
||||
const plans = paymentPlans.value.filter(v => {
|
||||
const plans = paymentPlans.value.filter((v) => {
|
||||
return !$empty(v.value) && !$empty(v.type);
|
||||
});
|
||||
|
||||
@@ -288,7 +403,9 @@ async function update() {
|
||||
|
||||
if (plans.length > 0) {
|
||||
if (props.row?.id) {
|
||||
const oldPlans = await $getdata("paymentplan", { policy: policyResult.id });
|
||||
const oldPlans = await $getdata("paymentplan", {
|
||||
policy: policyResult.id,
|
||||
});
|
||||
|
||||
if (oldPlans && oldPlans.length > 0) {
|
||||
for (const oldPlan of oldPlans) {
|
||||
@@ -304,7 +421,6 @@ async function update() {
|
||||
|
||||
emit("modalevent", { name: "dataevent", data: policyResult });
|
||||
emit("close");
|
||||
|
||||
} catch (error) {
|
||||
$snackbar("Lưu dữ liệu thất bại");
|
||||
} finally {
|
||||
@@ -321,14 +437,14 @@ function selected(attr, obj) {
|
||||
}
|
||||
|
||||
function planSelected(attr, obj, plan) {
|
||||
if (attr === 'type') {
|
||||
if (obj && typeof obj === 'object') {
|
||||
if (attr === "type") {
|
||||
if (obj && typeof obj === "object") {
|
||||
plan.type = obj.id;
|
||||
plan._type = obj;
|
||||
} else {
|
||||
plan.type = obj;
|
||||
}
|
||||
} else if (attr === 'value') {
|
||||
} else if (attr === "value") {
|
||||
plan.value = Number(obj);
|
||||
} else {
|
||||
plan[attr] = obj;
|
||||
|
||||
Reference in New Issue
Block a user