File: /home/bdedition/public_html/core/resources/views/admin/users/list.blade.php
@extends('admin.layouts.app')
@section('panel')
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body p-0">
<div class="table-responsive--md table-responsive">
<table class="table table--light style--two">
<thead>
<tr>
<th>@lang('Staff')</th>
<th>@lang('Email-Mobile')</th>
<th>@lang('Country')</th>
<th>@lang('Joined At')</th>
<th>@lang('News')</th>
<th>@lang('Action')</th>
</tr>
</thead>
<tbody>
@forelse($users as $user)
<tr>
<td>
<span class="fw-bold">{{ $user->fullname }}</span>
<br>
<span class="small">
<a href="{{ route('admin.users.detail', $user->id) }}">
<span>@</span>{{ $user->username }}
</a>
</span>
</td>
<td>{{ $user->email }}<br>{{ $user->mobileNumber }}</td>
<td>
<span class="fw-bold" title="{{ @$user->country_name }}">
{{ $user->country_code }}
</span>
</td>
<td>
{{ showDateTime($user->created_at) }} <br>
{{ diffForHumans($user->created_at) }}
</td>
<td><span class="fw-bold">{{ $user->news_count }}</span></td>
<td>
<div class="button--group">
<a href="{{ route('admin.users.detail', $user->id) }}"
class="btn btn-sm btn-outline--primary">
<i class="las la-desktop"></i> @lang('Details')
</a>
</div>
</td>
</tr>
@empty
<tr>
<td class="text-muted text-center" colspan="100%">{{ __($emptyMessage) }}</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
@if ($users->hasPages())
<div class="card-footer py-4">
{{ paginateLinks($users) }}
</div>
@endif
</div>
</div>
</div>
<div class="modal fade" id="addStaffModal">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="getLangModalLabel">@lang('Add New Staff')</h4>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<i class="las la-times"></i>
</button>
</div>
<form action="{{ route('admin.users.store') }}" method="POST" class="disableSubmission">
@csrf
<div class="modal-body">
<div class="row">
<div class="col-lg-4">
<div class="form-group">
<label>@lang('First Name')</label>
<input type="text" name="firstname" class="form-control" required>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('Last Name')</label>
<input type="text" name="lastname" class="form-control" required>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('Father Name')</label>
<input type="text" name="fatherName" class="form-control" required>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('Mother Name')</label>
<input type="text" name="motherName" class="form-control" required>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('NID')</label>
<input type="text" name="nid" class="form-control" required>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('District')</label>
<input type="text" name="district" class="form-control" required>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('Upazila')</label>
<input type="text" name="upazila" class="form-control" required>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('Email')</label>
<input type="email" class="form-control" name="email" required>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('Username')</label>
<input type="text" name="username" class="form-control" required>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('Country')</label>
<select name="country" class="form-control select2" required>
@foreach ($countries as $key => $country)
<option value="{{ $country->country }}" data-code="{{ $key }}"
data-mobile_code="{{ $country->dial_code }}">
{{ __($country->country) }}
</option>
@endforeach
</select>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('Mobile Number')</label>
<div class="input-group ">
<span class="input-group-text mobile-code">--</span>
<input type="hidden" name="mobile_code">
<input type="hidden" name="country_code">
<input type="number" name="mobile" class="form-control" required>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('Password')</label>
<input type="password" name="password" class="form-control" required>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('Confirm Password')</label>
<input type="password" name="password_confirmation" class="form-control" required>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label>@lang('Designation')</label>
<select name="designation" class="form-control select2" required>
<option value="">Select Designation</option>
<option value="peb">@lang('President of the Editorial Board')</option>
<option value="advisor">@lang('Advisor')</option>
<option value="editor">@lang('Editor')</option>
<option value="executiveEditor">@lang('Executive editor')</option>
<option value="managingEditor">@lang('Managing editor')</option>
<option value="deputyEditor">@lang('Deputy editor')</option>
<option value="jointEditor">@lang('Joint editor')</option>
<option value="associateEditor">@lang('Associate editor')</option>
<option value="newsEditor">@lang('News editor')</option>
<option value="assistantEditor">@lang('Assistant Editor')</option>
<option value="featureEditor">@lang('Feature Editor')</option>
<option value="specialCorrespondent">@lang('Special Correspondent')</option>
<option value="cityEditor">@lang('City Editor')</option>
<option value="jointNewsEditor">@lang('Joint News Editor')</option>
<option value="chiefCorrespondent">@lang('Chief Correspondent')</option>
<option value="subEditor">@lang('Sub-Editor')</option>
<option value="chiefSubEditor">@lang('Chief Sub-Editor')</option>
<option value="staffEditor">@lang('Staff Editor')</option>
<option value="sportsEditor">@lang('Sports Editor')</option>
<option value="editorialAssistant">@lang('Editorial Assistant')</option>
<option value="associateEditor">@lang('Associate Editor')</option>
<option value="staffCorrespondent">@lang('Staff Correspondent')</option>
<option value="ownCorrespondent">@lang('Own Correspondent')</option>
<option value="sportsCorrespondent">@lang('Sports Correspondent')</option>
<option value="artist">@lang('Artist')</option>
</select>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn--primary w-100 h-45">@lang('Submit')</button>
</div>
</form>
</div>
</div>
</div>
@endsection
@push('breadcrumb-plugins')
<x-search-form placeholder="Username / Email" />
<button type="button" class="btn btn-outline--primary btn-sm addNewStaff">
<i class="las la-plus"></i>@lang('Add New Staff')
</button>
@endpush
@push('script')
<script>
(function($) {
"use strict";
$('.addNewStaff').on('click', function() {
var modal = $('#addStaffModal');
$('input[name=mobile_code]').val($('select[name=country] :selected').data('mobile_code'));
$('input[name=country_code]').val($('select[name=country] :selected').data('code'));
$('.mobile-code').text('+' + $('select[name=country] :selected').data('mobile_code'));
modal.modal('show');
});
$('select[name=country]').on('change', function() {
$('input[name=mobile_code]').val($('select[name=country] :selected').data('mobile_code'));
$('input[name=country_code]').val($('select[name=country] :selected').data('code'));
$('.mobile-code').text('+' + $('select[name=country] :selected').data('mobile_code'));
});
})(jQuery);
</script>
@endpush