1010 header="Bulk AI Flow"
1111 class="!max-w-full w-full lg:w- [1600px] !lg:max-w- [1600px]"
1212 :buttons =" [
13- { label: checkedCount > 1 ? ' Save fields' : ' Save field' , options: { disabled: isLoading || checkedCount < 1 || isCriticalError , loader: isLoading , class: ' w-fit sm:w-40' }, onclick : (dialog ) => { saveData (); dialog .hide (); } },
13+ { label: checkedCount > 1 ? ' Save fields' : ' Save field' , options: { disabled: isLoading || checkedCount < 1 || isCriticalError || isFetchingRecords , loader: isLoading , class: ' w-fit sm:w-40' }, onclick : (dialog ) => { saveData (); dialog .hide (); } },
1414 { label: ' Cancel' , onclick : (dialog ) => dialog .hide () },
1515 ] "
1616 >
3131 :primaryKey =" primaryKey "
3232 :openGenerationCarousel =" openGenerationCarousel "
3333 @error =" handleTableError "
34+ :carouselSaveImages =" carouselSaveImages "
35+ :carouselImageIndex =" carouselImageIndex "
3436 />
3537 </div >
3638 <div class =" text-red-600 flex items-center w-full" >
@@ -73,11 +75,14 @@ const tableColumns = ref([]);
7375const tableColumnsIndexes = ref ([]);
7476const customFieldNames = ref ([]);
7577const selected = ref <any []>([]);
78+ const carouselSaveImages = ref <any []>([]);
79+ const carouselImageIndex = ref <any []>([]);
7680const isAiResponseReceivedAnalize = ref ([]);
7781const isAiResponseReceivedImage = ref ([]);
7882const primaryKey = props .meta .primaryKey ;
7983const openGenerationCarousel = ref ([]);
8084const isLoading = ref (false );
85+ const isFetchingRecords = ref (false );
8186const isError = ref (false );
8287const isCriticalError = ref (false );
8388const isImageGenerationError = ref (false );
@@ -102,7 +107,7 @@ const openDialog = async () => {
102107 return acc ;
103108 },{[primaryKey ]: records .value [i ][primaryKey ]} as Record <string , boolean >);
104109 }
105- isLoading .value = true ;
110+ isFetchingRecords .value = true ;
106111 const tasks = [];
107112 if (props .meta .isFieldsForAnalizeFromImages ) {
108113 tasks .push (runAiAction ({
@@ -126,14 +131,34 @@ const openDialog = async () => {
126131 }));
127132 }
128133 await Promise .all (tasks );
129- isLoading .value = false ;
134+
135+ if (props .meta .isImageGeneration ) {
136+ fillCarouselSaveImages ();
137+ }
138+
139+ isFetchingRecords .value = false ;
130140}
131141
132142watch (selected , (val ) => {
133143 // console.log('Selected changed:', val);
134144 checkedCount .value = val .filter (item => item .isChecked === true ).length ;
135145}, { deep: true });
136146
147+ function fillCarouselSaveImages() {
148+ for (const item of selected .value ) {
149+ const tempItem: any = {};
150+ const tempItemIndex: any = {};
151+ for (const [key, value] of Object .entries (item )) {
152+ if (props .meta .outputImageFields ?.includes (key )) {
153+ tempItem [key ] = [value ];
154+ tempItemIndex [key ] = 0 ;
155+ }
156+ }
157+ carouselSaveImages .value .push (tempItem );
158+ carouselImageIndex .value .push (tempItemIndex );
159+ }
160+ }
161+
137162
138163function formatLabel(str ) {
139164 return str
0 commit comments