    <form id="form_edit" autocomplete="off">
      <div class="modal-header">
        <h1 class="modal-title fs-4"><?= $title ?></h1>
        <!-- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> -->
      </div>
      <div class="modal-body">
          <div class="row px-0 mx-0">
            <div class="col-12 col-md-6 mb-3 mb-md-4 px-2 ">
              <label for="name" class="ps-1 mb-1">Nama</label>
              <input type="hidden" class="d-none" id="hide_id"  name="hide_id" value="<?= $row->id ?>" />
              <input type="text" class="form-control" id="name" placeholder="Masukan nama disini" name="name" value="<?= $row->name ?>" />
              <span class="text-danger ps-1 error-message-name" style="font-size: 12px; display: none;" ></span>
            </div>
            <div class="col-12 col-md-6 mb-3 mb-md-4 px-2 ">
              <label for="category_id" class="ps-1 mb-1">Kategori</label>
              <select class="form-control select2" name="category_id" id="category_id" style="width: 100%">
                <option value="">Pilih Kategori</option>
              </select>
              <span class="text-danger ps-1 error-message-category_id" style="font-size: 12px; display: none;"></span>
            </div>
            <div class="col-12 col-md-6 mb-3 mb-md-4 px-2 ">
              <label for="unit_id" class="ps-1 mb-1">Satuan</label>
              <select class="form-control select2" name="unit_id" id="unit_id" style="width: 100%">
                <option value="">Pilih Satuan</option>
              </select>
              <span class="text-danger ps-1 error-message-unit_id" style="font-size: 12px; display: none;"></span>
            </div>
            <div class="col-12 col-md-6 mb-3 mb-md-4 px-2 ">
              <label for="price_buy" class="ps-1 mb-1">Harga Beli</label>
              <input type="text" class="form-control" id="price_buy" placeholder="Masukan harga beli disini" name="price_buy" value="<?= $row->price_buy ?>" />
              <span class="text-danger ps-1 error-message-price_buy" style="font-size: 12px; display: none;" ></span>
            </div>
            <div class="col-12 col-md-6 mb-3 mb-md-4 px-2 ">
              <label for="price_sale" class="ps-1 mb-1">Harga Jual</label>
              <input type="text" class="form-control" id="price_sale" placeholder="Masukan harga jaul disini" name="price_sale" value="<?= $row->price_sale ?>" />
              <span class="text-danger ps-1 error-message-price_sale" style="font-size: 12px; display: none;" ></span>
            </div>
            <div class="col-12 col-md-6 mb-3 mb-md-4 px-2 ">
              <label for="discount" class="ps-1 mb-1">Diskon</label>
              <input type="text" class="form-control" id="discount" placeholder="Masukan discount disini" name="discount" value="<?= $row->discount ?>" />
              <span class="text-danger ps-1 error-message-discount" style="font-size: 12px; display: none;" ></span>
            </div>
            <div class="col-12 mb-3 mb-md-4 px-2 ">
              <label for="description" class="ps-1 mb-1">Keterangan</label>
              <textarea type="text-danger" class="form-control" id="description" placeholder="Masukan description disini" name="description" ><?= $row->description ?></textarea>
              <span class="text-danger ps-1 error-message-description" style="font-size: 12px; display: none;" ></span>
            </div>
            <!-- Upload Gambar Section -->
            <div class="col-12 mb-4 px-2">
              <label class="ps-1 mb-2 d-block">Upload Gambar</label>

              

              <div class="upload-area px-4 py-5 text-center border rounded" style="position: relative;" id="uploadArea">

                <?php if(!empty($row->image)&&strtoupper($row->image)!="DEFAULT.PNG"): ?>


                  <div class="upload-content" style="display: none;">
                    <i class="bi bi-cloud-arrow-up fs-1 text-muted mb-3"></i>
                    <p class="mb-1 fw-semibold">Upload gambar produk kamu</p>
                    <!-- <p class="text-muted mb-2">or</p> -->
                    <button type="button" class="btn btn-outline-primary btn-sm my-2" id="btn_choose_edit">Pilih File</button>
                    <input type="file" id="fileInputEdit" class="d-none" accept="image/jpeg,image/png,image/gif,image/svg+xml">
                    <!-- <p class="text-muted mt-3 mb-0 small">Max file size: 50MB</p> -->
                    <p class="text-muted small">Supported file types: JPG, PNG, GIF, SVG</p>
                  </div>
                  <div class="upload-preview d-none" id="uploadPreview">
                    <div class="d-flex align-items-center">
                      <i class="bi bi-file-earmark-image fs-3 me-3 text-primary"></i>
                      <div class="text-start">
                        <p class="mb-1 fw-semibold" id="fileName">filename.jpg</p>
                        <p class="text-muted small mb-0" id="fileSize">25.4 MB</p>
                      </div>
                      <button type="button" class="btn-close ms-auto" id="removeFile"></button>
                    </div>
                  </div>
                  <div id="image_preview_edit" class="d-flex justify-content-center align-items-center" style=" background-color: #eaf7f2;">
                      <div class="d-flex align-items-center position-relative"> 
                      <img src="<?= base_url() ?>uploads/goods/<?= $row->image ?>" alt="Gambar Produk" style="max-height: 100%; max-width: 100%; object-fit: contain;">

                      <button type="button" class="btn btn-sm position-absolute bg-danger text-white btn-delete-img translate-middle rounded-circle p-1" style="transform: translate(50%, -50%);">
                        <i class="bx bx-x"></i>
                      </button>

                      <input type="hidden" name="image" style="width: 0; height: 0; display: none;" value="<?= $row->image ?>">

                    </div>
                  </div>


                <?php else: ?>

                  <div class="upload-content">
                    <i class="bi bi-cloud-arrow-up fs-1 text-muted mb-3"></i>
                    <p class="mb-1 fw-semibold">Upload gambar produk kamu</p>
                    <!-- <p class="text-muted mb-2">or</p> -->
                    <button type="button" class="btn btn-outline-primary btn-sm my-2" id="btn_choose_edit">Pilih File</button>
                    <input type="file" id="fileInputEdit" class="d-none" accept="image/jpeg,image/png,image/gif,image/svg+xml">
                    <!-- <p class="text-muted mt-3 mb-0 small">Max file size: 50MB</p> -->
                    <p class="text-muted small">Supported file types: JPG, PNG, GIF, SVG</p>
                  </div>
                  <div class="upload-preview d-none" id="uploadPreview">
                    <div class="d-flex align-items-center">
                      <i class="bi bi-file-earmark-image fs-3 me-3 text-primary"></i>
                      <div class="text-start">
                        <p class="mb-1 fw-semibold" id="fileName">filename.jpg</p>
                        <p class="text-muted small mb-0" id="fileSize">25.4 MB</p>
                      </div>
                      <button type="button" class="btn-close ms-auto" id="removeFile"></button>
                    </div>
                  </div>
                  <div id="image_preview_edit" class="d-none justify-content-center align-items-center" style=" background-color: #eaf7f2;">

                  </div>

                <?php endif; ?>
              </div>
            </div>
          </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Tutup</button>
        <button type="submit" class="btn btn-primary">Simpan</button>
      </div>
    </form>

    

