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

No files matched your search

+24 -35
View File
@@ -56,35 +56,33 @@ 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>
<Label height="compact">Kode</Label>
<Field :errMessage="errors.code">
<Input <Input
id="code" id="code"
v-model="code" v-model="code"
v-bind="codeAttrs" v-bind="codeAttrs"
:disabled="isLoading" :disabled="isLoading"
:class="{ 'border-red-500': errors.code }"
/> />
<span v-if="errors.code" class="text-sm text-red-500"> </Field>
{{ errors.code }} </Cell>
</span> <Cell>
</div> <Label height="compact">Nama</Label>
<div class="grid gap-2"> <Field :errMessage="errors.name">
<label for="name">Nama</label>
<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 }"
/> />
<span v-if="errors.name" class="text-sm text-red-500"> </Field>
{{ errors.name }} </Cell>
</span> <Cell>
</div> <Label height="compact">Satuan</Label>
<div class="grid gap-2"> <Field :errMessage="errors.uom_code">
<label for="uom">Satuan</label>
<Select <Select
id="uom" id="uom"
v-model="uom" v-model="uom"
@@ -93,39 +91,30 @@ function onCancelForm() {
v-bind="uomAttrs" v-bind="uomAttrs"
:items="uoms" :items="uoms"
:disabled="isLoading" :disabled="isLoading"
:class="{ 'border-red-500': errors.uom_code }"
/> />
<span v-if="errors.uom_code" class="text-sm text-red-500"> </Field>
{{ errors.uom_code }} </Cell>
</span> <Cell>
</div> <Label height="compact">Stok</Label>
<div class="grid gap-2"> <Field :errMessage="errors.stock">
<label for="stock">Stok</label>
<Input <Input
id="stock" id="stock"
v-model="stock" v-model="stock"
type="number" type="number"
v-bind="stockAttrs" v-bind="stockAttrs"
:disabled="isLoading" :disabled="isLoading"
:class="{ 'border-red-500': errors.stock }"
/> />
<span v-if="errors.stock" class="text-sm text-red-500"> </Field>
{{ errors.stock }} </Cell>
</span> </Block>
</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>
+19 -28
View File
@@ -55,35 +55,33 @@ 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>
<Label height="compact">Kode</Label>
<Field :errMessage="errors.code">
<Input <Input
id="code" id="code"
v-model="code" v-model="code"
v-bind="codeAttrs" v-bind="codeAttrs"
:disabled="isLoading" :disabled="isLoading"
:class="{ 'border-red-500': errors.code }"
/> />
<span v-if="errors.code" class="text-sm text-red-500"> </Field>
{{ errors.code }} </Cell>
</span> <Cell>
</div> <Label height="compact">Nama</Label>
<div class="grid gap-2"> <Field :errMessage="errors.name">
<label for="name">Nama</label>
<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 }"
/> />
<span v-if="errors.name" class="text-sm text-red-500"> </Field>
{{ errors.name }} </Cell>
</span> <Cell>
</div> <Label height="compact">Satuan</Label>
<div class="grid gap-2"> <Field :errMessage="errors.uom_code">
<label for="uom">Satuan</label>
<Select <Select
id="uom" id="uom"
icon-name="i-lucide-chevron-down" icon-name="i-lucide-chevron-down"
@@ -92,25 +90,18 @@ function onCancelForm() {
v-bind="uomAttrs" v-bind="uomAttrs"
:items="uoms" :items="uoms"
:disabled="isLoading" :disabled="isLoading"
:class="{ 'border-red-500': errors.uom_code }"
/> />
<span v-if="errors.uom_code" class="text-sm text-red-500"> </Field>
{{ errors.uom_code }} </Cell>
</span> </Block>
</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>