@extends('layouts.app', ['title' => __tr('Create New Template')]) @section('content') @include('users.partials.header', [ 'title' => __tr('Create New Carousel Template'), 'description' => '', 'class' => 'col-lg-7' ])
i !== index); }, addButton(cardIndex) { this.cards[cardIndex].buttons.push({ text: '', type: 'url', value: '' }); }, removeButton(cardIndex, btnIndex) { this.cards[cardIndex].buttons.splice(btnIndex, 1); }, serializeCards() { return JSON.stringify(this.cards); }, customButtons:{ totalAllowedButtons:10, totalButtonsUsed:0, buttonUsesByTypes:{ URL_BUTTON:0, URL_BUTTON_LIMIT:2, COPY_CODE:0, COPY_CODE_LIMIT:1, VOICE_CALL:0, VOICE_CALL_LIMIT:1, PHONE_NUMBER:0, PHONE_NUMBER_LIMIT:1 }, totalUrlButtonUsed:0, data:{}, }, goToStep(stepIndex) { this.currentStep = stepIndex; this.updateProgress(); }, nextStep() { if (this.currentStep < 3) { this.currentStep++; this.updateProgress(); } }, prevStep() { if (this.currentStep > 0) { this.currentStep--; this.updateProgress(); } }, updateProgress() { const progress = document.getElementById('progress'); const steps = document.querySelectorAll('.step'); const progressPercent = (this.currentStep / (steps.length - 1)) * 100; progress.style.width = progressPercent + '%'; steps.forEach((step, index) => { step.classList.remove('active', 'completed'); if (index < this.currentStep) { step.classList.add('completed'); } else if (index === this.currentStep) { step.classList.add('active'); } }); }, allCardsSameMediaType() { if (this.cards.length === 0) return true; const type = this.cards[0].mediaType; return this.cards.every(card => card.mediaType === type); }, addWhatsAppButtonOption : function(buttonType) { let uniqueBtnId = _.uniqueId(); this.customButtons.data[uniqueBtnId] = { buttonType : buttonType, buttonIndex : uniqueBtnId }; this.customButtons.totalButtonsUsed++; if((buttonType == 'URL_BUTTON') || (buttonType == 'DYNAMIC_URL_BUTTON')) { this.customButtons.buttonUsesByTypes['URL_BUTTON']++; } else if((buttonType == 'COPY_CODE')) { this.customButtons.buttonUsesByTypes['COPY_CODE']++; } else if((buttonType == 'VOICE_CALL')) { this.customButtons.buttonUsesByTypes['VOICE_CALL']++; } else if((buttonType == 'PHONE_NUMBER')) { this.customButtons.buttonUsesByTypes['PHONE_NUMBER']++; } }, deleteWhatsAppButtonOption : function(buttonIndex) { let buttonType = this.customButtons.data[buttonIndex]['buttonType']; if((buttonType == 'URL_BUTTON') || (buttonType == 'DYNAMIC_URL_BUTTON')) { this.customButtons.buttonUsesByTypes['URL_BUTTON']--; } else if((buttonType == 'COPY_CODE')) { this.customButtons.buttonUsesByTypes['COPY_CODE']-- ; } else if((buttonType == 'VOICE_CALL')) { this.customButtons.buttonUsesByTypes['VOICE_CALL']-- ; } else if((buttonType == 'PHONE_NUMBER')) { this.customButtons.buttonUsesByTypes['PHONE_NUMBER']-- ; } delete this.customButtons.data[buttonIndex]; delete this.buttonModels[buttonIndex]; this.customButtons.totalButtonsUsed--; }, addCardButton(cardIndex, buttonType) { let uniqueBtnId = _.uniqueId(); let card = this.cards[cardIndex]; card.customButtons.data[uniqueBtnId] = { buttonType: buttonType, buttonIndex: uniqueBtnId }; card.buttonModels[uniqueBtnId] = ''; if (buttonType === 'URL_BUTTON') { card.buttonModels[uniqueBtnId + '_url'] = ''; } if (buttonType === 'PHONE_NUMBER') { card.buttonModels[uniqueBtnId + '_phone'] = ''; } card.customButtons.totalButtonsUsed++; if(buttonType === 'URL_BUTTON') { card.customButtons.buttonUsesByTypes.URL_BUTTON++; } else if(buttonType === 'QUICK_REPLY') { card.customButtons.buttonUsesByTypes.QUICK_REPLY++; } else if(buttonType === 'PHONE_NUMBER') { card.customButtons.buttonUsesByTypes.PHONE_NUMBER++; } }, deleteCardButton(cardIndex, buttonIndex) { let card = this.cards[cardIndex]; let buttonType = card.customButtons.data[buttonIndex].buttonType; if(buttonType === 'URL_BUTTON') { card.customButtons.buttonUsesByTypes.URL_BUTTON--; } else if(buttonType === 'QUICK_REPLY') { card.customButtons.buttonUsesByTypes.QUICK_REPLY--; } else if(buttonType === 'PHONE_NUMBER') { card.customButtons.buttonUsesByTypes.PHONE_NUMBER--; } delete card.customButtons.data[buttonIndex]; delete card.buttonModels[buttonIndex]; delete card.buttonModels[buttonIndex + '_url']; delete card.buttonModels[buttonIndex + '_phone']; card.customButtons.totalButtonsUsed--; }}">
1
2
3
{{--
4
--}}

{{ __tr('Template Details') }}

{{ __tr('Template Formatting Help') }}
{{-- --}} @if(!__isEmpty($languages)) @foreach($languages as $key => $language) @endforeach @endif
{{-- --}}
{{ __tr('While Authentication and Flow templates are supported for sending however you need to create/edit those templates on Meta.') }} {{ __tr('Manage Templates on Meta') }}

{{ __tr('Message Body') }}

{{ __tr('This is the main message body shown above the carousel cards. Supports variables.') }}

{{ __tr('Carousel Cards') }} (/10)

{{--
--}} {{--
--}}

{{ __tr('Template Preview') }}

@endsection() @push('appScripts')