ultimatepos/Modules/ProfessionalProject/Resources/views/task_status/index.blade.php

61 lines
2.6 KiB
PHP

@extends('layouts.app')
@section('title', __('professionalproject::lang.task_statuses'))
@section('content')
@include('professionalproject::layouts.nav')
<section class="content-header"><h1>@lang('professionalproject::lang.task_statuses')</h1></section>
<section class="content">
<div class="box box-solid">
<div class="box-header with-border">
<button class="btn btn-primary btn-sm" id="add_status_btn"><i class="fa fa-plus"></i> @lang('professionalproject::lang.add_status')</button>
</div>
<div class="box-body">
<table class="table table-bordered">
<thead>
<tr>
<th>@lang('messages.name')</th>
<th>@lang('professionalproject::lang.color')</th>
<th>@lang('sale.position')</th>
<th>@lang('professionalproject::lang.is_completed_status')</th>
<th>@lang('messages.action')</th>
</tr>
</thead>
<tbody>
@foreach($statuses as $status)
<tr>
<td>{{ $status->title }}</td>
<td><span class="label" style="background:{{ $status->color }}">{{ $status->color }}</span></td>
<td>{{ $status->position }}</td>
<td>{{ $status->is_completed ? __('messages.yes') : __('messages.no') }}</td>
<td>
<button class="btn btn-xs btn-danger delete_status" data-id="{{ $status->id }}"><i class="fa fa-trash"></i></button>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</section>
@endsection
@section('javascript')
<script>
$(document).ready(function() {
$('#add_status_btn').click(function() {
var title = prompt('@lang("messages.name")');
if (!title) return;
$.post('{{ action([\Modules\ProfessionalProject\Http\Controllers\TaskStatusController::class, "store"]) }}', {
_token: '{{ csrf_token() }}', title: title, color: '#3498db'
}, function(r) { if (r.success) location.reload(); else toastr.error(r.msg); });
});
$('.delete_status').click(function() {
var id = $(this).data('id');
$.ajax({ method: 'DELETE', url: '/professional-project/task-statuses/' + id, data: { _token: '{{ csrf_token() }}' }, success: function(r) {
if (r.success) location.reload(); else toastr.error(r.msg);
}});
});
});
</script>
@endsection