Files
kaunter/resources/views/operasi/edit_marginmutu.blade.php
T
Hafifie PKB 73db8b97d7 1.added page that shows margin mutu harga emas.
2. change in gadaian page that have static 75% and 80% max pinjam turn to manipulate value of max pinjam based on mutu emas
2026-04-19 15:04:37 +08:00

119 lines
4.8 KiB
PHP

@extends('layouts.app_operasi')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<nav aria-label="breadcrumb">
<ol class="breadcrumb pb-3">
<li class="breadcrumb-item"><a href="{{ url('/') }}">Home</a></li>
<li class="breadcrumb-item"><a href="{{ url('operasi/parameter') }}">Parameter</a></li>
<li class="breadcrumb-item"><a href="{{ url('operasi/marginmutu') }}">Margin Mutu Emas</a></li>
<li class="breadcrumb-item active" aria-current="page">Edit Margin Mutu</li>
</ol>
</nav>
<div class="card-body">
<h4 class="text-center mb-4">Edit Margin Mutu Emas</h4>
<form id="editMarginForm">
@csrf
<input type="hidden" id="recno" name="recno">
<div class="form-group">
<label for="karat">Karat</label>
<input type="text" class="form-control" id="karat" name="karat" readonly>
</div>
<div class="form-group">
<label for="keterangan">Keterangan</label>
<input type="text" class="form-control" id="keterangan" name="keterangan" readonly>
</div>
<div class="form-group">
<label for="teller">Teller (%)</label>
<input type="number" step="0.01" class="form-control" id="teller" name="teller" required>
</div>
<div class="form-group">
<label for="pc">PC (%)</label>
<input type="number" step="0.01" class="form-control" id="pc" name="pc" required>
</div>
<div class="form-group">
<label for="operasi">Operasi (%)</label>
<input type="number" step="0.01" class="form-control" id="operasi" name="operasi" required>
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary">Update</button>
<a href="{{ route('operasi.marginmutu') }}" class="btn btn-secondary">Cancel</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
// Get data from URL parameters
const urlParams = new URLSearchParams(window.location.search);
$('#recno').val(urlParams.get('recno'));
$('#karat').val(urlParams.get('karat'));
$('#keterangan').val(urlParams.get('keterangan'));
$('#teller').val(urlParams.get('teller'));
$('#pc').val(urlParams.get('pc'));
$('#operasi').val(urlParams.get('operasi'));
$('#editMarginForm').on('submit', function(e) {
e.preventDefault();
const formData = {
recno: $('#recno').val(),
karat: $('#karat').val(),
keterangan: $('#keterangan').val(),
teller: $('#teller').val(),
pc: $('#pc').val(),
operasi: $('#operasi').val(),
_token: $('input[name="_token"]').val()
};
$.ajax({
url: '{{ config("api.url") }}/api/maxmutuemas/update',
type: 'POST',
data: formData,
success: function(response) {
if(response.status === 'success') {
Swal.fire({
title: 'Berjaya!',
text: 'Data berhasil diupdate!',
icon: 'success',
confirmButtonText: 'OK'
}).then((result) => {
window.location.href = '{{ route("operasi.marginmutu") }}';
});
} else {
Swal.fire({
title: 'Error!',
text: response.message,
icon: 'error',
confirmButtonText: 'OK'
});
}
},
error: function(xhr) {
Swal.fire({
title: 'Error!',
text: 'Error updating data: ' + xhr.responseText,
icon: 'error',
confirmButtonText: 'OK'
});
}
});
});
});
</script>
@endsection