mirror of
https://github.com/anna-sara/lan_kiosk
synced 2025-10-27 05:27:13 +01:00
Compare commits
No commits in common. "f68a18c6b3dcbbcddb62c7427c9e530a8381966b" and "5859ba1c4930bf65f4d555f42b3634cd9051e868" have entirely different histories.
f68a18c6b3
...
5859ba1c49
6 changed files with 2 additions and 92 deletions
|
|
@ -82,24 +82,6 @@ class CustomerController extends Controller
|
||||||
return redirect('customer/' . $customer->id);
|
return redirect('customer/' . $customer->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*/
|
|
||||||
public function updateComment(Request $request)
|
|
||||||
{
|
|
||||||
$request->validate([
|
|
||||||
'customer_id' => 'required',
|
|
||||||
'comment' => 'required',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$customer = Customer::findOrFail($request->customer_id);
|
|
||||||
|
|
||||||
$customer->comment = $request->comment;
|
|
||||||
$customer->save();
|
|
||||||
|
|
||||||
return redirect('customer/' . $customer->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ class Customer extends Model
|
||||||
'amount used',
|
'amount used',
|
||||||
'deposit',
|
'deposit',
|
||||||
'give_leftover',
|
'give_leftover',
|
||||||
'comment'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
Schema::table('customers', function (Blueprint $table) {
|
|
||||||
$table->mediumText('comment')->nullable();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::table('customers', function (Blueprint $table) {
|
|
||||||
$table->dropColumn('comment');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
@ -11,15 +11,6 @@
|
||||||
color: var(--button-link-color);
|
color: var(--button-link-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.button.is-info {
|
|
||||||
border: 1px solid var(--button-link-background-color);
|
|
||||||
color: var(--button-link-background-color);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
border: 2px solid var(--button-link-background-color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.button.letter {
|
.button.letter {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #000;
|
color: #000;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import TextInput from '@/Components/TextInput';
|
import TextInput from '@/Components/TextInput';
|
||||||
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout';
|
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout';
|
||||||
import { Textarea } from '@headlessui/react';
|
|
||||||
import { Head, useForm } from '@inertiajs/react';
|
import { Head, useForm } from '@inertiajs/react';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { FormEventHandler } from 'react';
|
import { FormEventHandler } from 'react';
|
||||||
|
|
@ -13,7 +12,6 @@ interface CustomerProps {
|
||||||
amount_left: number
|
amount_left: number
|
||||||
give_leftover: number
|
give_leftover: number
|
||||||
guardian_name: string
|
guardian_name: string
|
||||||
comment: string;
|
|
||||||
purchases: [{
|
purchases: [{
|
||||||
id: number
|
id: number
|
||||||
amount: number
|
amount: number
|
||||||
|
|
@ -31,8 +29,7 @@ export default function Customer({customer}: CustomerProps) {
|
||||||
amount: "",
|
amount: "",
|
||||||
customer_id: customer.id,
|
customer_id: customer.id,
|
||||||
deposit: "",
|
deposit: "",
|
||||||
id: customer.id,
|
id: customer.id
|
||||||
comment: ""
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const submit: FormEventHandler = (e) => {
|
const submit: FormEventHandler = (e) => {
|
||||||
|
|
@ -49,12 +46,6 @@ export default function Customer({customer}: CustomerProps) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateComment: FormEventHandler = (e) => {
|
|
||||||
e.preventDefault()
|
|
||||||
post(route('update_comment'), {
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const deleteCustomer = (id: string | number) => {
|
const deleteCustomer = (id: string | number) => {
|
||||||
axios.delete('/api/customer/' + id)
|
axios.delete('/api/customer/' + id)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
|
@ -128,30 +119,6 @@ export default function Customer({customer}: CustomerProps) {
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="box">
|
|
||||||
<h2 className='title is-4'>Kommentar</h2>
|
|
||||||
<form onSubmit={updateComment}>
|
|
||||||
<div className="field">
|
|
||||||
<div className="control">
|
|
||||||
<textarea
|
|
||||||
required
|
|
||||||
className="textarea"
|
|
||||||
name="comment"
|
|
||||||
defaultValue={customer.comment}
|
|
||||||
value={data.comment}
|
|
||||||
//placeholder="Kommentar"
|
|
||||||
onChange={(e) => setData('comment', e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="field is-grouped">
|
|
||||||
<div className="control">
|
|
||||||
<button className="button">Spara</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<details className="box">
|
<details className="box">
|
||||||
<summary className='title is-4 my-3'>
|
<summary className='title is-4 my-3'>
|
||||||
<span>Köp</span>
|
<span>Köp</span>
|
||||||
|
|
@ -193,7 +160,7 @@ export default function Customer({customer}: CustomerProps) {
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
<button onClick={() => deleteCustomer(customer.id)} className="button mt-4 mr-3 is-danger is-outlined is-small">
|
<button onClick={() => deleteCustomer(customer.id)} className="button mt-4 is-danger is-outlined is-small">
|
||||||
<span>Radera deltagare</span>
|
<span>Radera deltagare</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ Route::post('register_customer', [CustomerController::class, 'store'])->name('re
|
||||||
|
|
||||||
Route::middleware('auth:sanctum')->group(function () {
|
Route::middleware('auth:sanctum')->group(function () {
|
||||||
Route::post('register_deposit', [DepositController::class, 'store'])->name('register_deposit');
|
Route::post('register_deposit', [DepositController::class, 'store'])->name('register_deposit');
|
||||||
Route::post('update_comment', [CustomerController::class, 'updateComment'])->name('update_comment');
|
|
||||||
Route::post('register_purchase', [PurchaseController::class, 'store'])->name('register_purchase');
|
Route::post('register_purchase', [PurchaseController::class, 'store'])->name('register_purchase');
|
||||||
Route::delete('customer/{id}', [CustomerController::class, 'destroy'])->name('delete_customer');
|
Route::delete('customer/{id}', [CustomerController::class, 'destroy'])->name('delete_customer');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue