@extends('admins.layouts.index') @section('content') @if(!$request->input('message_type')) {!! Form::model($model, ['method'=>'get','class'=>'form-horizontal','files'=>true]) !!}

{{__('Basic Information')}}

{{ __('Message Type') }}
{!! Form::radio('message_type', App\SmsLog::type_new, true, ['id'=>'normal','class'=>'form-check-input']) !!}
{!! Form::radio('message_type', App\SmsLog::type_template, false, ['id'=>'unicode','class'=>'form-check-input']) !!}
{!! Form::label('template_id', __('Template'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::select('template_id', App\SmsTemplate::combobox(), null, ['id'=>'template_id','class'=>'form-control select2 '.($errors->first('template_id') ? 'is-invalid' : '')]) !!} {!!$errors->first('template_id', ':message')!!}
{{ __('Send By') }}
{!! Form::radio('send_by', App\SmsLog::type_new, true, ['id'=>'normal','class'=>'form-check-input']) !!}
{!! Form::radio('send_by', App\SmsLog::type_group, false, ['id'=>'unicode','class'=>'form-check-input']) !!}
{!! Form::label('group_id', __('Group'), ['class'=>'col-sm-4 col-form-label text-right']) !!}
{!! Form::select('group_id', App\CustomerGroup::combobox(), null, ['id'=>'group_id','class'=>'form-control select2 '.($errors->first('group_id') ? 'is-invalid' : '')]) !!} {!!$errors->first('group_id', ':message')!!}
{!! Form::close() !!} @else {!! Form::model($model, ['method'=>'post','class'=>'form-horizontal','files'=>true]) !!}

{{__('Basic Information')}}

{{ __('Message Type') }}
{!! Form::radio('message_type', 1, true, ['id'=>'normal','class'=>'form-check-input']) !!}
{!! Form::radio('message_type', 0, false, ['id'=>'unicode','class'=>'form-check-input']) !!}
{!! Form::label('send_to', __('Send To'), ['class'=>'col-sm-2 col-form-label text-right']) !!} {!! Form::hidden('send_by', $request->input('send_by')) !!} @if($request->input('send_by') == App\SmsLog::type_group)
{!! Form::text('group_name_displayed', null, ['id'=>'group_name_displayed','class'=>'form-control '.($errors->first('group_name_displayed') ? 'is-invalid' : ''),'disabled']) !!} {!! Form::hidden('group_id', $request->input('group_id')) !!}
@else
{!! Form::textarea('send_to', null, ['rows'=>5,'id'=>'send_to','class'=>'form-control '.($errors->first('send_to') ? 'is-invalid' : ''), 'placeholder'=>__('Important: Please use semicolon ; to seperate each phone number. Max limit only 100 mobile no.')]) !!} {{__('Please follow the format . eg: 60123456789')}} {!!$errors->first('send_to', ':message')!!}
@endif
{!! Form::label('message', __('Message'), ['class'=>'col-sm-2 col-form-label text-right']) !!}
{!! Form::textarea('message', null, ['rows'=>5,'id'=>'message','class'=>'form-control '.($errors->first('message') ? 'is-invalid' : ''),'placeholder'=>__('Type your message here...')]) !!} @if($request->input('send_by') == App\SmsLog::type_group) {{__('Personalized text : Put %name% to be replaced with name in address book.')}} @endif {!!$errors->first('message', ':message')!!}
{!! Form::close() !!} @endif @endsection @section('script') $(document).ready(function(){ if($("input[name=message_type]").val() == "{{ App\SmsLog::type_new }}") { var templateInputField = $("select[name=template_id]").closest(".form-group"); templateInputField.hide(); } if($("input[name=send_by]").val() == "{{ App\SmsLog::type_new }}") { var templateInputField = $("select[name=group_id]").closest(".form-group"); templateInputField.hide(); } }); $("input[name=message_type]").on("click", function(){ var selected = $(this).val(); var templateInputField = $("select[name=template_id]").closest(".form-group"); if(selected == "{{ App\SmsLog::type_new }}") { templateInputField.hide("slow"); } else { templateInputField.show("slow"); } }); $("input[name=send_by]").on("click", function(){ var selected = $(this).val(); var templateInputField = $("select[name=group_id]").closest(".form-group"); if(selected == "{{ App\SmsLog::type_new }}") { templateInputField.hide("slow"); } else { templateInputField.show("slow"); } }); @endsection