partial update crud customer data

This commit is contained in:
arifal
2025-02-21 00:46:33 +07:00
parent 7a56735099
commit 5c4be7635b
20 changed files with 898 additions and 3 deletions

View File

@@ -0,0 +1,32 @@
@extends('layouts.vertical', ['subtitle' => 'Data'])
@section('content')
@include('layouts.partials/page-title', ['title' => 'Data', 'subtitle' => 'PDAM'])
<x-toast-notification />
<div class="row d-flex justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header d-flex justify-content-end">
<a href="{{ route('customers') }}" class="btn btn-sm btn-secondary">Back</a>
</div>
<div class="card-body">
<form id="formCreateCustomer" action="{{ route('api.customers.store') }}" method="post">
@csrf
@include('customers.form')
<button type="button" class="btn btn-primary" id="btnCreateCustomer">
<span id="spinner" class="spinner-border spinner-border-sm me-1 d-none" role="status" aria-hidden="true"></span>
Create
</button>
</form>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
@vite(['resources/js/customers/create.js'])
@endsection

View File

@@ -0,0 +1,33 @@
@extends('layouts.vertical', ['subtitle' => 'Data'])
@section('content')
@include('layouts.partials/page-title', ['title' => 'Data', 'subtitle' => 'PDAM'])
<x-toast-notification />
<div class="row d-flex justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header d-flex justify-content-end">
<a href="{{ route('customers') }}" class="btn btn-sm btn-secondary">Back</a>
</div>
<div class="card-body">
<form id="formUpdateCustomer" action="{{ route('api.customers.update', $data->id) }}" method="post">
@csrf
@method('put')
@include('customers.form')
<button type="button" class="btn btn-primary" id="btnUpdateCustomer">
<span id="spinner" class="spinner-border spinner-border-sm me-1 d-none" role="status" aria-hidden="true"></span>
Update
</button>
</form>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
@vite(['resources/js/customers/edit.js'])
@endsection

View File

@@ -0,0 +1,24 @@
<div class="mb-3">
<label class="form-label" for="nomor_pelanggan">Nomor Pelanggan</label>
<input type="text" id="nomor_pelanggan" name="nomor_pelanggan" class="form-control" placeholder="Enter nomor_pelanggan" value="{{ old('nomor_pelanggan', $data->nomor_pelanggan ?? '') }}" required>
</div>
<div class="mb-3">
<label class="form-label" for="kota_pelayanan">Kota Pelayanan</label>
<input type="text" id="kota_pelayanan" name="kota_pelayanan" class="form-control" placeholder="Enter kota_pelayanan" value="{{ old('kota_pelayanan', $data->kota_pelayanan ?? '') }}" required>
</div>
<div class="mb-3">
<label class="form-label" for="nama">Nama</label>
<input type="text" id="nama" name="nama" class="form-control" placeholder="Enter nama" value="{{ old('nama', $data->nama ?? '') }}" required>
</div>
<div class="mb-3">
<label class="form-label" for="alamat">Alamat</label>
<textarea class="form-control" id="alamat" name="alamat" rows="5" required>{{ old('alamat', $data->alamat ?? '') }}</textarea>
</div>
<div class="mb-3">
<label class="form-label" for="latitude">Latitude</label>
<input type="text" id="latitude" name="latitude" class="form-control" placeholder="Enter latitude" value="{{ old('latitude', $data->latitude ?? '') }}" required>
</div>
<div class="mb-3">
<label class="form-label" for="longitude">Longitude</label>
<input type="text" id="longitude" name="longitude" class="form-control" placeholder="Enter longitude" value="{{ old('longitude', $data->longitude ?? '') }}" required>
</div>

View File

@@ -0,0 +1,31 @@
@extends('layouts.vertical', ['subtitle' => 'Data'])
@section('css')
@vite(['node_modules/gridjs/dist/theme/mermaid.min.css'])
@endsection
@section('content')
@include('layouts.partials/page-title', ['title' => 'Data', 'subtitle' => 'PDAM'])
<x-toast-notification/>
<div class="row">
<div class="col-12">
<div class="card w-100">
<div class="card-body">
<div class="d-flex flex-wrap justify-content-end align-items-center mb-2">
<a href="{{ route('customers.create')}}" class="btn btn-success btn-sm d-block d-sm-inline w-auto me-3">Create</a>
<a href="{{ route('customers.upload')}}" class="btn btn-success btn-sm d-block d-sm-inline w-auto">Upload</a>
</div>
<div id="table-customers"></div>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
@vite(['resources/js/customers/index.js'])
@endsection

View File

@@ -0,0 +1,80 @@
@extends('layouts.vertical', ['subtitle' => 'Data'])
@section('content')
@include('layouts.partials/page-title', ['title' => 'Data', 'subtitle' => 'Tata Ruang'])
<x-toast-notification />
<div class="row">
<div class="col-xl-12">
<div class="card">
<div class="card-header">
<h5 class="card-title">Upload Data</h5>
<p class="card-subtitle">
Please upload a file with the extension <strong>.xls or .xlsx</strong> with a maximum size of <strong>10 MB</strong>.
<br>
For <strong>.xls</strong> and <strong>.xlsx</strong> files, ensure that the data is contained within a <strong>single sheet</strong> with the following columns:
<strong>Nomor Pelanggan, Kota Pelayanan, Nama, Alamat, Latitude, Longitude</strong>
</p>
</div>
<div class="card-body">
<div class="mb-3">
<div class="dropzone">
<form id="formUploadCustomers" action="{{ route('api.customers.upload') }}" method="post" enctype="multipart/form-data">
<div class="fallback">
<!-- <input id="file-dropzone" type="file" name="file" accept=".xlsx,.xls" multiple/> -->
</div>
</form>
<div class="dz-message needsclick">
<i class="h1 bx bx-cloud-upload"></i>
<h3>Drop files here or click to upload.</h3>
</div>
</div>
<ul class="list-unstyled mb-0" id="dropzone-preview">
<li class="mt-2" id="dropzone-preview-list">
<!-- This is used as the file preview template -->
<div class="border rounded">
<div class="d-flex align-items-center p-2">
<div class="flex-shrink-0 me-3">
<div class="avatar-sm bg-light rounded">
<img data-dz-thumbnail class="img-fluid rounded d-block" src="#"
alt="" />
</div>
</div>
<div class="flex-grow-1">
<div class="pt-1">
<h5 class="fs-14 mb-1" data-dz-name>&nbsp;
</h5>
<p class="fs-13 text-muted mb-0" data-dz-size></p>
<strong class="error text-danger" data-dz-errormessage></strong>
</div>
</div>
<div class="flex-shrink-0 ms-3">
<button data-dz-remove class="btn btn-sm btn-danger">Delete</button>
</div>
</div>
</div>
</li>
</ul>
<!-- end dropzon-preview -->
</div>
<div class="d-flex justify-content-end">
<button id="submit-upload" class="btn btn-primary">
<span id="spinner" class="spinner-border spinner-border-sm me-1 d-none" role="status" aria-hidden="true"></span>
Upload Files
</button>
</div>
</div> <!-- end card body -->
</div> <!-- end card -->
</div> <!-- end col -->
</div> <!-- end row -->
@endsection
@section('scripts')
@vite(['resources/js/customers/upload.js'])
@endsection

View File

@@ -9,7 +9,6 @@
@include('layouts.partials/page-title', ['title' => 'Data', 'subtitle' => 'Tata Ruang'])
<x-toast-notification/>
<x-modal-confirmation buttonText="Delete" confirmationMessage="Are you sure you want to delete this?" />
<div class="row">
<div class="col-12">