%PDF- %PDF-
Direktori : /home/silvzytp/calling_code/resources/views/backend/pages/sub-status/ |
Current File : //home/silvzytp/calling_code/resources/views/backend/pages/sub-status/form.blade.php |
@extends('layouts.backend') @section('title', $siteTitle) @push('styles') @endpush @section('content') <div class="row"> <div class="col-12 col-sm-6 mx-auto"> <div class="card"> <div class="card-header"> <h4 class="mb-0 card-title">{{ $siteTitle }}</h4> </div> <div class="card-body"> <form action="{{ isset($callingStatus) ? route(routeName().'.sub-status.update', $callingStatus->id) : route(routeName().'.sub-status.store') }}" method="POST"> @csrf @isset($callingStatus) @method('PUT') @endisset <x-form.selectbox name="status" labelName="Status" error="status" required="required"> <option value="">-- Select Status --</option> @foreach ($status as $key=>$value) <option value="{{ $value->id }}" @isset($callingStatus) {{ $value->id == $callingStatus->status_id ? 'selected' : '' }} @endisset>{{ $value->name }}</option> @endforeach </x-form.selectbox> @isset($callingStatus) <x-form.inputbox labelName="Sub Status" name="name" required="required" value="{{ $callingStatus->name ?? old('name') }}"/> @else <table id="status_table" class="table table-borderless mt-3"> <tbody> <tr> <td class="px-0"> <input type="text" name="sub_status[1][name]" id="sub_status_1_name" class="form-control" placeholder="Enter Sub Status..." required> </td> <td class="px-0 text-right"> <button type="button" class="btn btn-primary add_status" id="add_status"><i class="fas fa-plus"></i></button> </td> </tr> </tbody> </table> @endisset <x-form.selectbox name="is_published" labelName="Is Published" error="is_published" required="required"> @foreach (STATUS as $key=>$value) <option value="{{ $key }}" @isset($callingStatus) {{ STATUS[$key] == $callingStatus->status ? 'selected' : '' }} @endisset>{{ $value }}</option> @endforeach </x-form.selectbox> <div class="text-right"> <button type="submit" class="btn btn-sm btn-success">Submit</button> </div> </form> </div> </div> </div> </div> @endsection @push('scripts') <script> // Dynamic permission field add remove var count = 1; function dynamicAppendField(row){ var html = ` <tr> <td class="px-0"> <input type="text" name="sub_status[`+row+`][name]" id="sub_status_`+row+`_name" class="form-control" placeholder="Enter Sub Status..." required> </td> <td class="px-0 text-right"> <button type="button" class="btn btn-danger add_status remove_status"><i class="fas fa-minus"></i></button> </td> </tr>`; $('#status_table tbody').append(html); } $(document).on('click', '#add_status', function () { count++; dynamicAppendField(count); }); $(document).on('click', '.remove_status', function () { count--; $(this).closest('tr').remove(); }); </script> @endpush