@extends ('layouts/template')

@section('content')

    <div class="p-3 mcp-theme-1">
    <div class="card">

        <div class="card-header px-3 py-2 d-flex align-items-center">
            <strong class="">
                <i class="fas fa-user-injured"></i>
                Text Shortcuts
            </strong>
            <span class="mx-2 text-secondary">|</span>
            <div moe wide class="mr-2">
                <a start show>
                    Add
                </a>
                <form url="/api/proTextShortcut/create">
                    <input type="hidden" name="proUid" value="{{$pro->uid}}">
                    <div class="mb-2">
                        <input type="text" class="form-control form-control-sm" name="shortcut"
                               placeholder="Shortcut *">
                    </div>
                    <div class="mb-2">
                        <textarea type="text" rows="10" class="form-control form-control-sm" name="text"
                                                      placeholder="Content *"></textarea>
                    </div>
                    <div class="form-group m-0">
                        <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
                        <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
                    </div>
                </form>
            </div>
        </div>
        <div class="card-body p-0">
            <table class="table table-condensed p-0 m-0">
                <thead class="bg-light">
                <tr>
                    <th class="px-3 border-0 w-25">Shortcut</th>
                    <th class="border-0">Text</th>
                    <th class="border-0 w-25">&nbsp;</th>
                </tr>
                </thead>
                <tbody>
                @foreach($myTextShortcuts as $textShortcut)
                    <tr>
                        <td class="px-3">{{ $textShortcut->shortcut }}</td>
                        <td><pre class="mb-0">{{ $textShortcut->text }}</pre></td>
                        <td>
                            <div class="d-flex align-items-center">
                                <div moe wide class="mr-3">
                                    <a start show>
                                        <i class="fa fa-pencil-alt"></i>
                                    </a>
                                    <form url="/api/proTextShortcut/update" right>
                                        <input type="hidden" name="uid" value="{{$textShortcut->uid}}">
                                        <div class="mb-2">
                                            <input type="text" class="form-control form-control-sm" name="shortcut"
                                                   value="{{$textShortcut->shortcut}}"
                                                   placeholder="Shortcut *">
                                        </div>
                                        <div class="mb-2">
                                            <textarea type="text" rows="10" class="form-control form-control-sm" name="text"
                                                      placeholder="Content *">{{$textShortcut->text}}</textarea>
                                        </div>
                                        <div class="form-group m-0">
                                            <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
                                            <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
                                        </div>
                                    </form>
                                </div>
                                <div moe relative wide class="mr-2">
                                    <a start show class="text-danger">
                                        <i class="fa fa-trash-alt"></i>
                                    </a>
                                    <form url="/api/proTextShortcut/remove" right>
                                        <input type="hidden" name="uid" value="{{$textShortcut->uid}}">
                                        <p>
                                            Are you sure you want to remove this shortcut?
                                        </p>
                                        <div class="form-group m-0">
                                            <button submit class="btn btn-danger btn-sm mr-2">Yes</button>
                                            <button cancel class="btn btn-default border btn-sm mr-2">No</button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>
    </div>
    </div>

@endsection
