<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<div class="card">
	<div class="card-body">
		<?php if (validation_errors()): ?>
			<div class="alert alert-danger"><?php echo validation_errors(); ?></div>
		<?php endif; ?>

		<form method="post">
			<div class="mb-3">
				<label class="form-label">Nama</label>
				<input type="text" class="form-control" name="name" value="<?php echo set_value('name', $row ? $row->name : ''); ?>" required>
			</div>
			<div class="mb-3">
				<label class="form-label">No. HP</label>
				<input type="text" class="form-control" name="phone" value="<?php echo set_value('phone', $row ? $row->phone : ''); ?>">
			</div>
			<div class="mb-3">
				<label class="form-label">Alamat</label>
				<textarea class="form-control" name="address" rows="3"><?php echo set_value('address', $row ? $row->address : ''); ?></textarea>
			</div>
			<div class="d-flex gap-2">
				<button class="btn btn-primary" type="submit"><?php echo $mode === 'edit' ? 'Simpan' : 'Tambah'; ?></button>
				<a class="btn btn-outline-secondary" href="<?php echo site_url('customers'); ?>">Kembali</a>
			</div>
		</form>
	</div>
</div>

