chore: refactor entry for equipment and tools

This commit is contained in:
riefive
2025-09-24 11:58:01 +07:00
parent 01acd00b0d
commit 7c452c923a
2 changed files with 92 additions and 112 deletions
+52 -63
View File
@@ -56,76 +56,65 @@ function onCancelForm() {
</script> </script>
<template> <template>
<form id="form-equipment" class="grid gap-2"> <form id="form-equipment">
<div class="grid gap-2"> <Block labelSize="thin" class="!mb-2.5 xl:!mb-3 !pt-0" :colCount="1">
<label for="code">Kode</label> <Cell>
<Input <Label height="compact">Kode</Label>
id="code" <Field :errMessage="errors.code">
v-model="code" <Input
v-bind="codeAttrs" id="code"
:disabled="isLoading" v-model="code"
:class="{ 'border-red-500': errors.code }" v-bind="codeAttrs"
/> :disabled="isLoading"
<span v-if="errors.code" class="text-sm text-red-500"> />
{{ errors.code }} </Field>
</span> </Cell>
</div> <Cell>
<div class="grid gap-2"> <Label height="compact">Nama</Label>
<label for="name">Nama</label> <Field :errMessage="errors.name">
<Input <Input
id="name" id="name"
v-model="name" v-model="name"
v-bind="nameAttrs" v-bind="nameAttrs"
:disabled="isLoading" :disabled="isLoading"
:class="{ 'border-red-500': errors.name }" />
/> </Field>
<span v-if="errors.name" class="text-sm text-red-500"> </Cell>
{{ errors.name }} <Cell>
</span> <Label height="compact">Satuan</Label>
</div> <Field :errMessage="errors.uom_code">
<div class="grid gap-2"> <Select
<label for="uom">Satuan</label> id="uom"
<Select v-model="uom"
id="uom" icon-name="i-lucide-chevron-down"
v-model="uom" placeholder="Pilih satuan"
icon-name="i-lucide-chevron-down" v-bind="uomAttrs"
placeholder="Pilih satuan" :items="uoms"
v-bind="uomAttrs" :disabled="isLoading"
:items="uoms" />
:disabled="isLoading" </Field>
:class="{ 'border-red-500': errors.uom_code }" </Cell>
/> <Cell>
<span v-if="errors.uom_code" class="text-sm text-red-500"> <Label height="compact">Stok</Label>
{{ errors.uom_code }} <Field :errMessage="errors.stock">
</span> <Input
</div> id="stock"
<div class="grid gap-2"> v-model="stock"
<label for="stock">Stok</label> type="number"
<Input v-bind="stockAttrs"
id="stock" :disabled="isLoading"
v-model="stock" />
type="number" </Field>
v-bind="stockAttrs" </Cell>
:disabled="isLoading" </Block>
:class="{ 'border-red-500': errors.stock }"
/>
<span v-if="errors.stock" class="text-sm text-red-500">
{{ errors.stock }}
</span>
</div>
<div class="my-2 flex justify-end gap-2 py-2"> <div class="my-2 flex justify-end gap-2 py-2">
<Button type="button" variant="secondary" class="w-[120px]" @click="onCancelForm"> Kembali </Button> <Button type="button" variant="secondary" class="w-[120px]" @click="onCancelForm"> Kembali </Button>
<Button <Button
type="button" type="button"
class="w-[120px]" class="w-[120px]"
:disabled="isLoading" :disabled="isLoading"
@click=" @click="handleSubmit(onSubmitForm)"
() => {
handleSubmit(onSubmitForm)()
}
"
> >
<!-- <Loader2 v-if="isLoading" class="mr-2 h-4 w-4 animate-spin" /> -->
Simpan Simpan
</Button> </Button>
</div> </div>
+40 -49
View File
@@ -55,62 +55,53 @@ function onCancelForm() {
</script> </script>
<template> <template>
<form id="form-tools" class="grid gap-2"> <form id="form-tools">
<div class="grid gap-2"> <Block labelSize="thin" class="!mb-2.5 xl:!mb-3 !pt-0" :colCount="1">
<label for="code">Kode</label> <Cell>
<Input <Label height="compact">Kode</Label>
id="code" <Field :errMessage="errors.code">
v-model="code" <Input
v-bind="codeAttrs" id="code"
:disabled="isLoading" v-model="code"
:class="{ 'border-red-500': errors.code }" v-bind="codeAttrs"
/> :disabled="isLoading"
<span v-if="errors.code" class="text-sm text-red-500"> />
{{ errors.code }} </Field>
</span> </Cell>
</div> <Cell>
<div class="grid gap-2"> <Label height="compact">Nama</Label>
<label for="name">Nama</label> <Field :errMessage="errors.name">
<Input <Input
id="name" id="name"
v-model="name" v-model="name"
v-bind="nameAttrs" v-bind="nameAttrs"
:disabled="isLoading" :disabled="isLoading"
:class="{ 'border-red-500': errors.name }" />
/> </Field>
<span v-if="errors.name" class="text-sm text-red-500"> </Cell>
{{ errors.name }} <Cell>
</span> <Label height="compact">Satuan</Label>
</div> <Field :errMessage="errors.uom_code">
<div class="grid gap-2"> <Select
<label for="uom">Satuan</label> id="uom"
<Select icon-name="i-lucide-chevron-down"
id="uom" placeholder="Pilih satuan"
icon-name="i-lucide-chevron-down" v-model="uom"
placeholder="Pilih satuan" v-bind="uomAttrs"
v-model="uom" :items="uoms"
v-bind="uomAttrs" :disabled="isLoading"
:items="uoms" />
:disabled="isLoading" </Field>
:class="{ 'border-red-500': errors.uom_code }" </Cell>
/> </Block>
<span v-if="errors.uom_code" class="text-sm text-red-500">
{{ errors.uom_code }}
</span>
</div>
<div class="my-2 flex justify-end gap-2 py-2"> <div class="my-2 flex justify-end gap-2 py-2">
<Button variant="secondary" class="w-[120px]" @click="onCancelForm"> Kembali </Button> <Button variant="secondary" class="w-[120px]" @click="onCancelForm"> Kembali </Button>
<Button <Button
type="button" type="button"
class="w-[120px]" class="w-[120px]"
:disabled="isLoading" :disabled="isLoading"
@click=" @click="handleSubmit(onSubmitForm)"
() => {
handleSubmit(onSubmitForm)()
}
"
> >
<!-- <Loader2 v-if="isLoading" class="mr-2 h-4 w-4 animate-spin" /> -->
Simpan Simpan
</Button> </Button>
</div> </div>